snoopie Posted November 19, 2016 Share Posted November 19, 2016 (edited) Greetings, All of the sudden my TimerDiff() or _Timer_Diff() functions return only roughly half of the elapsed time: #include <Date.au3> ConsoleWrite(_NowTime() & @TAB & "Begin..." & @CRLF) $TestTimer = TimerInit() $StartDate = _NowCalc() Sleep(4000) $sElapsed = _DateDiff('s', $StartDate, _NowCalc()) ConsoleWrite(_NowTime() & @TAB & TimerDiff($TestTimer) & @TAB & $sElapsed & @CRLF) Console output: Quote 06:38:28 Begin... 06:38:32 1941.9144144926 4 It was all working fine on this machine the past few weeks (i7 6700K, Win7 x64). Does anyone have an idea how this can be possible? Thanks! Update: Restarting Windows solved the issue but I still would love to know how this can happen. Console output after Windows restart: Quote 06:50:02 Begin... 06:50:06 3994.88592655121 4 Edited November 19, 2016 by snoopie Update Link to comment Share on other sites More sharing options...
mikell Posted November 19, 2016 Share Posted November 19, 2016 Maybe... if the machine slowed down... _DateDiff could take more time to return I'd do it like this #include <Date.au3> ConsoleWrite(_NowTime() & @TAB & "Begin..." & @CRLF) $TestTimer = TimerInit() $StartDate = _NowCalc() Sleep(4000) $sElapsed2 = _DateDiff('s', $StartDate, _NowCalc()) $sElapsed1 = TimerDiff($TestTimer) ConsoleWrite(_NowTime() & @TAB & $sElapsed1 & @TAB & $sElapsed2 & @CRLF) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now