One of my scripts stopped working after the update to MT4 v4.00 Build 1353 (16 Dec 2021). This script relies on an accurate value returned by function TimeCurrent(). I conducted a test with the following script on an MT4 platform which uses timezone GMT+2h:
The result I get is something like:
The above result shows that, Current Time is 9s AHEAD of where it should be. IF GMT is 08:35:23, then GMT+2h should be 10:35:23. Why does TimeCurrent() return 10:35:32, which is 9s ahead?
Is your computer time accurate? You may try to synchronize.
OK. I went to Windows time settings, then turned on "Set Time Zone Automatically" and now I no longer have the issue in MT4. Thanks for your suggestion. Looks like it has nothing to do with Build 1353.
I still don't understand though. Why would the value of TimeCurrent() be dependent on my computer's time? I thought it's an absolute value returned by the broker's server.
OK. I went to Windows time settings, then turned on "Set Time Zone Automatically" and now I no longer have the issue in MT4. Thanks for your suggestion. Looks like it has nothing to do with Build 1353.
I still don't understand though. Why would the value of TimeCurrent() be dependent on my computer's time? I thought it's an absolute value returned by the broker's server.
TimeGMT is based on TimeLocal.
TimeCurrent is always accurate. Problems arise when it is compared to TimeGMT or TimeLocal and the computer clock is out of synch.
-
Don't double post! You already had another thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017) -
datetime timeDifference = MT4_currentTime - currentGMT_Time;
The difference between two datetimes is not a datetime, it's an int.
TimeGMT is based on TimeLocal.
TimeCurrent is always accurate. Problems arise when it is compared to TimeGMT or TimeLocal and the computer clock is out of synch.
Thanks, but that doesn't really help. On my system it was TimeCurrent() that returned an erroneous value. TimeGMT() was fine. Well, now that I can no longer replicate the error we'll never know why. But thanks.
-
Don't double post! You already had another thread open.
General rules and best pratices of the Forum. - General - MQL5 programming forum (2017) - The difference between two datetimes is not a datetime, it's an int.
I double-posted here because someone in the other thread asked the moderator to delete my posts because they weren't relevant to Build 1353. I guess I now agree. The problem was on my system from the look of it.
"The difference between two datetimes is not a datetime, it's an int" - Thanks for the clarification.Wrong. It is whatever the last server time sent was.
There was a case about ten (10) years ago, where the time was correct, but the date was several days ahead.
When it was corrected, many EAs stopped working for those days because the new bar code used greater or equal (>=) instead of not equal (!=).
Wrong. It is whatever the last server time sent was.
There was a case about ten (10) years ago, where the time was correct, but the date was several days ahead.
When it was corrected, many EAs stopped working for those days because the new bar code used greater or equal (>=) instead of not equal (!=).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
One of my scripts stopped working after the update to MT4 v4.00 Build 1353 (16 Dec 2021). This script relies on an accurate value returned by function TimeCurrent(). I conducted a test with the following script on an MT4 platform which uses timezone GMT+2h:
The result I get is something like:
The above result shows that, Current Time is 9s AHEAD of where it should be. IF GMT is 08:35:23, then GMT+2h should be 10:35:23. Why does TimeCurrent() return 10:35:32, which is 9s ahead?
Would someone please fill me in? Why is TimeCurrent 9s ahead? It wasn't this way before in previous builds. I made some posts about this problem in the Build 1353 thread but I was told that this is normal. How can it be normal? GMT+2h should mean EXACTLY GMT+2h, without any discrepancy.