Should GetLocalTime () "skip back"?
I know I QueryPerformanceCounter
can return values ββthat are not monotonic / intermittent (i.e. time can appear backwards) due to sampling from unsynchronized clocks distributed across multicore or multiprocessor architectures.
I would have thought I had GetLocalTime()
avoided these problems, although I cannot find anything definite to say about it. When I created this function:
int GetTimeAsMillisecondsSinceMidnight()
{
SYSTEMTIME theTime;
GetLocalTime( &theTime );
return 3600000*theTime.wHour + 60000*theTime.wMinute
+ 1000*theTime.wSecond + theTime.wMilliseconds;
}
... I was surprised to create events at 20-30 per second, timestamp using the return value from this function, and find out that sometimes the timestamp "bounced back" by as much as 4 seconds on a reasonably updated 64-bit Windows 8 system running on a Core i7 processor.
What is the likely cause of this "jump back" in time? If GetLocalTime()
is the culprit, are there any alternatives that have similar resolution / precision but avoid the timing gap issues?
source to share
No one has answered this question yet
See similar questions:
or similar: