Timers and timing, was: MySQL Performance 6.0rc1

Poul-Henning Kamp phk at phk.freebsd.dk
Sat Oct 29 14:43:26 PDT 2005


In message <20051029210550.GV4115 at funkthat.com>, John-Mark Gurney writes:

>This also gets into the question how do you round a second? :)

I had this discussion with Bruce some years back and the (or at
least my) answer is: you don't round timestamps, you truncate.

My argument for this is what's commonly called "times arrow" mandates
truncation instead of rounding.

Rounding is about finding the nearest point of a lower resolution
and this is fine for meter, lightyears, money and so on where
reality is isotropic.

But time never goes backwards.  We don't know why, but it just
doesn't [1].

Because of this, it only makes sense (IMO) to truncate, because
that ensures that we never get a timestamp in the future [2]

>If you cared that much that you were .001 seconds after 124, you'd be
>using a more acurate clock...

It's not if you care about the delay, it's if you compare output
from time(2) to clock_gettime()...

Poul-Henning


[1]  No, I don't want to discuss if gravity is the accumulation of
time in an Einsteinian geometry, much less if the Aliens taught the
ancient egyptians how to reverse time so that the pyramid could be
completed before pharao died.

[2] If our timestamps had operated in a signed fraction fashion
(ie: as in "ten minutes to noon") it would be an entirely different
situation, but then I think more people than me would be cursing
POSIX.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list