bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: timestamp resolution


From: Hans Aberg
Subject: Re: timestamp resolution
Date: Sat, 5 May 2007 14:05:21 +0200

On 4 May 2007, at 07:25, Larry Dwyer wrote:
At 07:21 PM 5/3/2007, address@hidden wrote:
> Having a clock number implies that the clock can be used with
> clock_gettime() or even timer_create(). There is no reason to assume
> that there is such a clock available.

However, if there is such a clock available, being able to call
clock_gettime() on it is a *good* thing.  In those cases (such as a
network filesystem) where it is not available, clock_gettime() can
always return an error.

As Ulrich points out, an implementation would need a unique clock_id for each file system it supports. Even if this was considered a reasonable solution, we would have to invent a new function, or reuse pathconf(..), to associate the particular clock_id value that corresponds to a particular filesystem.

I haven't followed this discussion too closely, but I think one of the best ways to count (calendar) time is using the Julian period used by astronomers:
  http://en.wikipedia.org/wiki/Julian_day

It sets the epoch (time 0.0) to noon UT (Universal Time), January 1, -4712 (= 4713 BC, as the astronomical year 0 = 1 BC). Calendar conversions are easy. (The number of seconds since that date requires 38 bits, I got it to.)

Systems that uses a different epoch, merely needs to indicate the time offset.


On 4 May 2007, at 00:20, James Youngman wrote:

I can't think offhand of an exception.  The difference between the
MS-DOS epoch and the Unix epoch is evenly divisible by 2 seconds (I
think; though there were 9 leap seconds in the 1970s, hmm...).  But
might there be an exception I can't immediately recall?  Quite
probably.

This would also resolve problems with leap seconds: just do what UT does. There is a proposal to scrap the leap seconds in favor of leap hours, in which case one only needs to take into account the leap seconds introduced so far, as it takes a couple of thousand years until the first leap hour comes by.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]