Sign in to follow this  
Followers 0
snoopie

TimerDiff() returns only 50% of elapsed time

2 posts in this topic

#1 ·  Posted (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 by snoopie
Update

Share this post


Link to post
Share on other sites



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)

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0