Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Oct 2005 23:43:22 +0200
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        John-Mark Gurney <gurney_j@resnet.uoregon.edu>
Cc:        Pertti Kosunen <pertti.kosunen@pp.nic.fi>, Robert Watson <rwatson@FreeBSD.org>, David Xu <davidxu@FreeBSD.org>, "Yuriy N. Shkandybin" <jura@networks.ru>, current@FreeBSD.org
Subject:   Re: Timers and timing, was: MySQL Performance 6.0rc1 
Message-ID:  <43332.1130622202@critter.freebsd.dk>
In-Reply-To: Your message of "Sat, 29 Oct 2005 14:05:50 PDT." <20051029210550.GV4115@funkthat.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20051029210550.GV4115@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@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43332.1130622202>