I thought that the server always reports time as GMT, but I am getting a 9-hour
difference betwen my TimeLocal - Vancouver, Canada, which is in the Pacific Standard
Time zone, which is the same as GMT(-8) - and the server time (TimeCurrent()).
That would mean that the time I am getting from the server is not a GMT time but
it's own local time.
But even if the local time of the server is returned - again, MetaQuotes Demo server
(AlpariUK-Demo) should be in the GMT zone (it says it's UK, would be logical to
assume it is in the UK somwehere, correct?), so again I'm looking for a 8-hour
difference and yet I am getting 9 hours... :(
I thought it could it be something is messsed up with DST and where MQL gets the
local time on my computer? But how can it be - it displays it properly when I use
Print to print it...
help please, Here's the snippet I am running:
boolbFirstTick=true;
intTimeDiffWithServer(){intiTimeServer = TimeCurrent();
intiTimeLocal = TimeLocal();
// compensate for a possible diff. in seconds due to network lagintiTimeServerSecondsOnly = iTimeServer%60;
intiTimeLocalSecondsOnly = iTimeLocal%60;
iTimeLocal = iTimeLocal-iTimeLocalSecondsOnly+iTimeServerSecondsOnly;
return(iTimeLocal-iTimeServer);
}//+------------------------------------------------------------------+//| expert start function |//+------------------------------------------------------------------+intstart(){//----if(bFirstTick){Print("Current Local time: ", TimeToStr(TimeLocal(), TIME_DATE|TIME_SECONDS));
Print("Current Server time: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS));
Print("Current Local time: ", TimeLocal());
Print("Current Server time: ", TimeCurrent());
Print("Time Diff with server is : ", TimeDiffWithServer()/PERIOD_H1/60," hours");
bFirstTick=false;
}//----return(0);
}
this is the output:
2007.01.30 19:58:07 TestTimeZone EURUSD,M1: removed
2007.01.30 19:58:07 TestTimeZone EURUSD,M1: deinitialized
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Time Diff with server is : -9 hours
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Server time: 1170219480
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Local time: 1170187080
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Server time: 2007. 01. 31 04:58:00
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Local time: 2007. 01.30 19:58:00
2007.01.30 19:57:58 TestTimeZone EURUSD,M1: initialized
2007.01.30 19:57:50 TestTimeZone EURUSD,M1: loaded successfully
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I thought that the server always reports time as GMT, but I am getting a 9-hour difference betwen my TimeLocal - Vancouver, Canada, which is in the Pacific Standard Time zone, which is the same as GMT(-8) - and the server time (TimeCurrent()). That would mean that the time I am getting from the server is not a GMT time but it's own local time.
But even if the local time of the server is returned - again, MetaQuotes Demo server (AlpariUK-Demo) should be in the GMT zone (it says it's UK, would be logical to assume it is in the UK somwehere, correct?), so again I'm looking for a 8-hour difference and yet I am getting 9 hours... :(
I thought it could it be something is messsed up with DST and where MQL gets the local time on my computer? But how can it be - it displays it properly when I use Print to print it...
help please, Here's the snippet I am running:
this is the output:
2007.01.30 19:58:07 TestTimeZone EURUSD,M1: removed
2007.01.30 19:58:07 TestTimeZone EURUSD,M1: deinitialized
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Time Diff with server is : -9 hours
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Server time: 1170219480
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Local time: 1170187080
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Server time: 2007. 01. 31 04:58:00
2007.01.30 19:58:00 TestTimeZone EURUSD,M1: Current Local time: 2007. 01.30 19:58:00
2007.01.30 19:57:58 TestTimeZone EURUSD,M1: initialized
2007.01.30 19:57:50 TestTimeZone EURUSD,M1: loaded successfully
thanks