Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!amdahl!oliveb!sun!gorodish!guy From: guy@gorodish.Sun.COM (Guy Harris) Newsgroups: comp.bugs.4bsd Subject: Re: ctime(3) and leap seconds :-( Keywords: ctime, leap second, epoch Message-ID: <38641@sun.uucp> Date: 12 Jan 88 21:59:58 GMT References: <604@PT.CS.CMU.EDU> <6976@brl-smoke.ARPA> <20532@amdahl.amdahl.com> <20700@amdahl.amdahl.com> Sender: news@sun.uucp Lines: 52 > POSIX does not say that a conforming machine MUST have the correct time! *Portable Operating System Interface for Computer Environments", P1003.1/DRAFT 12, October 12, 1987, page 24: Epoch The Epoch refers to the time at 0 hours, 0 minutes, 0 seconds, Coordinated Universal Time on January 1, 1970. The value "seconds since the Epoch" refers to the difference in seconds between the referenced time and the Epoch, not counting leap seconds. Page 81: 4.5.1 Get System Time Function: time() ... 4.5.1.2 Description The time() function returns the value of time in seconds since the Epoch (see Epoch (section)2.3). Sorry, but POSIX DOES say that a conforming machine MUST have correct time, or more precisely it must have the correct time minus the number of leap seconds since 0 hours, 0 minutes, 0 seconds, Coordinated Universal Time on January 1, 1970. I.e, if at some time T it is currently 569,022,442 seconds since the point in time labelled as 0 hours, 0 minutes, 0 seconds, Coordinated Universal Time on January 1, 1970 (which is roughly what it is as I type this), the difference in seconds between the referenced time and the Epoch is 569,022,442. There have been 14 leap seconds between that time and the Epoch; were some timekeeper not to count those seconds, it would have counted only 569,022,428 seconds. Thus, at that time T, a call to "time()" on a POSIX system returns 569,022,428. Not 569,022,442; not 469,022,368; not 569,022,488. > What it does say is that given some specific time, it MUST produce the > same timestamp. What does "it MUST produce the same timestamp" mean? If it means "all POSIX systems must, if 'time()' is called at some time T, return the same value", then it certainly says that - it also says what that value must be! Furthermore, it says that this value must NOT include leap seconds, which means that if the system e.g. keeps time by bumping a counter every second it must avoid doing so for leap seconds. That may not have been what you MEANT to have POSIX say, but it's what you DID make POSIX say. If that's not what you meant, you'll have to try again. Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com