4 ms·
Win95 had a famous timer wrap at 49.7 days. Ouch. All timers should either be really tiny (whereupon they are good subjects for test cases) or really huge and
by kabdib 15y ago
Win95 had a famous timer wrap at 49.7 days. Ouch.
All timers should either be really tiny (whereupon they are good subjects for test cases) or really huge and not subject to possible rollover (64 bits of nanoseconds is 580 years, and should serve for an interval counter).
128 bits of nanoseconds is 10E22 years, and should serve to drive calendar time, unless you're doing cosmology.
- mappu 15y agoWin95 had a famous timer wrap at 49.7 days. Ouch. The API call in question is called GetTickCount[1], and it's still really popular - especially for doing quick things like comparing for timeouts, and so forth. It returns milliseconds into a 32-bit int. There's a replacement named, funnily enough, GetTickCount64, but iirc it's only present on Vista and newer, so it hasn't found its way into a lot of software yet. The Windows Performance counters probably provide better metrics for people actually interested in this data. _______________________ 1. http://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms72...
- marshray 15y agoI recently had to implement a version of GetTickCount64 for older platforms that only support GetTickCount(32). It works great as long as you remember to call it at least every 49.7 days. :-) (Luckily the process already had a thread which wakes up to perform such maintenance every hour or so.)
- deleted 15y ago[deleted]
- xpaulbettsx 15y agoYep - there is still code in the kernel and in AppVerifier to simulate the rollover to test against these kinds of bugs.
- carbocation 15y ago256 bits of Planck time units is 10^26 years. No rollover, for any reason, ever. http://www.wolframalpha.com/input/?i=2%5E256+units+of+planck+time+in+years http://www.wolframalpha.com/input/?i=2%5E256+units+of+planck...