Re: Timers and timing, was: MySQL Performance 6.0rc1

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Sat, 29 Oct 2005 23:43:22 +0200
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.
Received on Sat Oct 29 2005 - 19:43:26 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:46 UTC