An unexpected result while using Sleep() New comment Reza nasimi 2019.11.15 15:19 Hello everyone I need to measure the most possible precis time delay of some operations. While I was working on it, I had some unexpected result. void OnTick() { uint Timer_Start = GetTickCount(); uint Delay = GetTickCount() - Timer_Start; Comment(Delay); } It comments 0 on the chart. How is it possible? Then I added a sleep function and it got worse. void OnTick() { uint Timer_Start = GetTickCount(); Sleep(1000); uint Delay = GetTickCount() - Timer_Start; Comment(Delay); //--- } The result is mostly 998 and 999 . some other values are also shown but it seems all of them are less than 1000. How is it possible? I think I used those functions just like what the documentation says. GetTickCount - Common Functions - MQL4 Reference docs.mql4.com Counter is limited by the restrictions of the system timer. Time is stored as an unsigned integer, so it's overfilled every 49.7 days if a computer works uninterruptedly. How to stop a secuence in a EA Help with some code - Stuck in a loop RefreshRates, init() and start() William Roeder 2019.11.15 16:20 #1 Reza nasimi: How is it possible? Because the Windows system timer has always been (IIRC) 16 ms. Therefor Sleep is approximate. Reza nasimi 2019.11.15 16:32 #2 William Roeder: Because the Windows system timer has always been (IIRC) 16 ms. Therefor Sleep is approximate. Thanks William Roeder New comment
Hello everyone
I need to measure the most possible precis time delay of some operations.
While I was working on it, I had some unexpected result.
It comments 0 on the chart. How is it possible?
Then I added a sleep function and it got worse.
The result is mostly 998 and 999 . some other values are also shown but it seems all of them are less than 1000.
How is it possible?
I think I used those functions just like what the documentation says.