I wrote a function:
// 8.1 Returns the value of the specified time in the local time zone. ============================================================================================================
datetime getTimeInLocalTimeZone(datetime date){
MqlDateTime dt;
TimeToStruct(date, dt);
return TimeLocal(dt);
}
I thought that this way I would return the date with the time in the local time zone. But what I do not pass through the parameter, it still returns the time that is at the moment, and not the time that I pass, even if it is some days ago. This raised a question. What is this parameter for?
I thought TimeLocal() that is, without parameters, it returns the current local time, and with TimeLocal(dt) parameters, it returns the time for the date dt. If not, what is the point of this parameter?
vdev
Georges, you speak to the vehicle in an alien language )))) Fun forum, soon it will be necessary to call Petrosyan.
hoz
In Java, I’ve always worked this way. In C#, too, I think it should be. They’re too similar. Unless there are no delegates in Java..
laryx
Come on… Use the standard carray descendant – and return pointers to yourself.
The only problem with array pointers in MLQ is the standard timeseries arrays passed to indicators. You can’t take the pointer directly, so you have to copy it. But this is the only case. In all other cases, we use the successor class CArray, and all problems with pointers to arrays disappear.
dimeon
Excuse my ignorance, but in what language does a function return an entire array? As far as I know, C returns a pointer to an array. In MQL, the pointer cannot be returned. Security. Because then you can get into the system memory and do something there. (I may not be quite right here either).
tecciztecatl
hoz
Why would that be? Reading..
Return value of datetime. Type of the datetime function. How can a function return nothing?
alexeyvik
Because TimeLocal (dt) does not return a date, but writes it to the dt structure.
She is a structure…