Hi,
I am working on an File-based history system, whose function is to store and retrieve some history information.
Inside file, I use GetLocalTime() to get the File Start Time, store it on the file header. And then I use GetTickCount() to store the Time Offset of items into file.
Finally, I create a tool to calculate the absolute time with the start and the offset time.
But I found the calculated time is not match with the real absolute time.
for example:
Suppose I start the file at 10:30:28
DWORD x = GetTickCount();
void TimeoutWakeupFucntion()
{
DWORD y = GetTickCount();
DWORD Offset = (y >= x) ? (y - x) : (MAXDWORD - x + y);
SYSTEMTIME st;
GetLocalTime(&st);
}
Then
Time Offset Real Absolute Time
1997 10:30:40.578
2995 10:30:41.583
.
.
.
184986 10:33:44.138
That is to say, the calculated time is always shorter than the real time.
Does anybody know what's wrong?
Thank you so much!