UTC timestamp in milliseconds using C ++ on Windows

How to get UTC time in milliseconds under a Windows platform?

I use a standard library that gives me UTC time in seconds. I want to get time in milliseconds. Is there a link to another library that gives me the exact UTC time in milliseconds?

+3
source share
2 answers

GetSystemTime () creates a UTC timestamp with millisecond resolution. The accuracy, however, is much worse, the clock is usually updated at 15.625 millisecond intervals on most Windows machines. There is not much point in the pursuit of improved accuracy; any watch that provides an absolute time stamp is subject to drift. You need special equipment, usually a GPS radio, to get something better. Which are difficult to use properly in a multitasking operating system other than real-time. The worst delay can be up to 200 milliseconds.

+6
source

Use GetSystemTimethe API function, or perhaps GetSystemTimeAsFileTimeif you need one number.

+7
source

Source: https://habr.com/ru/post/1746152/


All Articles