News for hackers. Stuff that matters.
Re:Let’s Stop the Unix Time Insanity by dap on Monday December 02, 2013 @07:52PM (#6837764)
At least on a single system, it's not that hard. You have to get over the fact that you can't compute accurate intervals by recording two human-datetime timestamps. Even aside from the myriad edge cases around date arithmetic, an administrator (or NTP) can always reset the clock between the endpoints of your interval, and your computation may be very wrong.

If you want a human timestamp, use gettimeofday[0] and related functions. If you want something to compute actual elapsed seconds with, use high-resolution timestamps([2] and [3]). You just can't have both, and that's because of the way human dates work, not the way we represent them.

[0] http://pubs.opengroup.org/onlinepubs/009695399/functions/get... [1] http://www.lehman.cuny.edu/cgi-bin/man-cgi?gethrtime+3 [2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/cl...

There are no comments on this comment yet.