What's the best replacement for timeGetTime to avoid wrap-around?

Posted by phjr on Stack Overflow See other posts from Stack Overflow or by phjr
Published on 2010-05-13T09:54:46Z Indexed on 2010/05/13 10:04 UTC
Read the original article Hit count: 139

Filed under:
|
|

timeGetTime seems to be quite good to query for system time. However, its return value is 32-bit only, so it wraps around every 49 days approx.

It's not too hard to detect the rollover in calling code, but it adds some complexity, and (worse) requires keeping a state.

Is there some replacement for timeGetTime that would not have this wrap-around problem (probably by returning a 64-bit value), and have roughly the same precision and cost?

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows