Re: Unix notion of "Seconds since the Epoch"

From: Markus Kuhn <Markus.Kuhn_at_CL.CAM.AC.UK>
Date: Thu, 30 Jan 2003 17:09:58 +0000

John Cowan wrote on 2003-01-30 16:35 UTC:
> Markus Kuhn scripsit:
>
> > As I noted earlier, de facto and "de jure" (meaning POSIX.1:1996,
> > section 2.2.2.113), any real world Unix file system (and that's where
> > the term "seconds since the epoch" comes from in this context) uses a
> > timestamp that counts "non-leap seconds since the epoch".
> >
> > http://www.cl.cam.ac.uk/~mgk25/volatile/posix-2-2-2-113.pdf
>
> That page shows a definition of the term "seconds since the Epoch", viz.
> "[a] value to be interpreted as the number of seconds between a specified
> time and the Epoch."

It also provides the formula that defines the encoding of UTC into that
integer, leaving no doubt about the exact semantics.

The 1996 version of POSIX has now been superceeded by the 2001 version,
and I have scanned in the equivalent page from IEEE Std 1003.1-2001 for
you on

  http://www.cl.cam.ac.uk/~mgk25/volatile/posix-secs-since-epoch-2001.pdf

This clarification was made after exactly the same discussion that we
have here took place within POSIX. The new definition now says (slightly
abbreviated)

  A value that approximates the number of seconds that have elapsed
  since the Epoch. A UTC name (specified in terms of seconds, minutes, etc.)
  is related to a time represented as seconds since the Epoch according to
  the expression below.

followed by the usual conversion formula, this time now even including
the full Gregorian leap year correction that was still missing in the
1996 version.

This reformulation of the standard should finally remove any doubt about
what exactly the term "seconds since the epoch" means under Unix and
makes clear that it is meant to encode a UTC clock value and not to
represent any exact number of physical SI seconds since the epoch.

There is now additional wording that now leaves explicitely the exact
relationship between the actual time of day and the "seconds since the
epoch" value undefined, in order to allow implementors to smooth out the
behaviour near leap seconds as in UTS or in BSD's adjtime(1). This
should help to convince people that the unfortunate
step-back-by-1-second implementation of leap seconds in the Linux NTP
kernel PLL is not required by POSIX.

Markus

--
Markus Kuhn, Computer Lab, Univ of Cambridge, GB
http://www.cl.cam.ac.uk/~mgk25/ | __oo_O..O_oo__
Received on Thu Jan 30 2003 - 09:10:53 PST

This archive was generated by hypermail 2.3.0 : Sat Sep 04 2010 - 09:44:54 PDT