Getting the current time (in milliseconds) from the system clock in Windows?

Viewed 107324

How can you obtain the system clock's current time of day (in milliseconds) in C++? This is a windows specific app.

7 Answers

While it's not what the question asks, it's worth considering why you want this info.

If all you want to do is keep track of how long something takes to calculate or the time past since the last user interaction, consider using the uptime (milliseconds since boot), which is much simpler to get: GetTickCount() or GetTickCount64(). This is all I wanted to do but I went down the epoch rabbit hole first because that's how you do it under unix.

Related