Monotonicity of gettimeofday()
Posted Feb 20, 2003 18:42 UTC (Thu) by
zooko (subscriber, #2589)
In reply to:
Monotonicity of gettimeofday() by im14u2c
Parent article:
Kernel release status
No offense, but I think this is the Unix "worse is better" heritage.
Suppose that you were writing an app that depends on time being monotonically non-decreasing. If this assumption fails, your house catches on fire. Now are you satisfied with this "under normal circumstances" position?
No, you're not. You want a slightly stronger guarantee. As in "under all circumstances unless there is a very peculiar electrical malfunction in your CPU".
I don't think it is too difficult to offer a guaranteed (up to peculiarly malfunctioning hardware) non-decreasing timer. The cost is that you just have to give up on the idea that this same timer is also reflecting human time (UTC). I have in fact implemented such a thing in user space for my app, but it is quite expensive to do in user space, and I would have to go through the filesystem in order to get the guarantee past the app shutting down. Ugh! That is an extremely expensive and awkward, compared to doing it in kernel land and storing the value in some nice battery-backed NVRAM or something.
(
Log in to post comments)