How to get the UTC time in milliseconds under windows platform. I am using Standard library which give me UTC time in seconds, I want to get time in miliseconds, kindly give me the reference of any other library which give me the accurate UTC time in miliseconds.
+6
A:
Use GetSystemTime
API function, or perhaps GetSystemTimeAsFileTime
if you want a single number.
avakar
2010-05-19 10:01:15
+2
A:
GetSystemTime() produces a UTC time stamp with millisecond resolution. Accuracy however is far worse, the clock usually updates at 15.625 millisecond intervals on most Windows machines. There isn't much point in chasing improved accuracy, any clock that provides an absolute time stamp is subject to drift. You'd need dedicated hardware, usually a GPS radio clock, to get something better. Which are hard to use properly on a non-realtime multi-tasking operating system. Worst-case latency can be as much as 200 milliseconds.
Hans Passant
2010-05-19 15:01:21