Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Seconds from 19xx to Date (and visa versa) Message-ID: <340@auspex.UUCP> Date: 28 Oct 88 04:32:36 GMT Article-I.D.: auspex.340 References: <5522@hoptoad.uucp> <10030@socslgw.csl.sony.JUNET> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 24 >> Does anyone have a routine to change back and forth between >> seconds from 19xx to a Year, Month, Day sort of Date? > >You need more than a routine to do this. You need a database of when >leap seconds have occurred. Sometimes on June 30th or December 31st, >the last minute runs from 11:59:00 to 11:59:60 (sixty-one seconds) in >order to compensate for wobbles in the earth's rotation. These do >not happen as regularly as leap days, so their occurrences cannot be >computed by a a routine; you need a database. The "Arthur Olson" time handling code, posted to "comp.sources.unix" (I think), handles this in its latest version (it even includes a database of leap seconds up to the present). >(The dpANSI C standard had the field for seconds redefined to allow a >value of 60 for exactly this reason. I proposed the same correction >to the committees standardizing Extended Pascal.) Unfortunately, POSIX explicitly rules *out* doing this, so you probably don't want to do this on UNIX. Note that in 99 44/100% of the cases it doesn't make a bit of difference; I have a Sun which means I don't trust it to get the time right down to the second anyway....