7 ms·
So let's say I want easy cross-platform access to a monotonic timer which gives me the number of egg timer (to use the phrase here) milliseconds since a certain
by Scramblejams 13y ago
So let's say I want easy cross-platform access to a monotonic timer which gives me the number of egg timer (to use the phrase here) milliseconds since a certain UTC time. Assume that I've got an NTP server available to keep me somewhat near atomic reality, and let's neglect relativistic shenanigans. Is there such a function call?
- nitrogen 13y agoIs clock_gettime() what you're looking for (specified in POSIX)? Although, in one embedded program of mine, when I run it fast enough it spends more time inside of clock_gettime() measuring itself than it does actually running. http://man.cx/clock_gettime http://man.cx/clock_gettime
- Scramblejams 13y agoThanks nitrogen for the link. Maybe it is, but I'm not experienced enough with time issues to know. I'm wondering what happens when your PC's crystal is a few percent slow or fast, and an NTP client applies corrections. Sure, it stays monotonic (with CLOCK_MONOTONIC), but what happens beyond that? And, is there equivalent functionality available on Windows?