Time

Simon Marlow simonmar at microsoft.com
Thu Jan 27 04:46:48 EST 2005


On 26 January 2005 21:27, Peter Simons wrote:

> Marcin 'Qrczak' Kowalczyk writes:
> 
>  >> 23:59:60
> 
>  > [...] and UTC doesn't have leap seconds.
> 
> Just a minor point ... it does, see above. ;-) I'm not sure
> how the loss of a second would be expressed, though.

This is quite a subtle point.  What people have been referring to as
"UTC seconds" I would call time_t.  time_t does not include leap seconds
in its count; rather the actual duration of a second gets longer around
a leap second.

UTC is a calendar in which some minutes have 61 seconds.

My library in fact maps both seconds to 23:59:59 at a leap second:

> let t = CalendarTime{ ctYear=1998, ctMonth=11, ctDay=31, ctHour=23,
ctMin=59, ctSec=59, ctPicosec=0, ctTZ=utcTimezone }
> clockTimeToUTCTime (fromJust (calendarTimeToClockTime t))
Thu Dec 31 23:59:59 UTC 1998
> clockTimeToUTCTime (fromJust (calendarTimeToClockTime t) + 10^12)
Thu Dec 31 23:59:59 UTC 1998
> clockTimeToUTCTime (fromJust (calendarTimeToClockTime t) + 2*10^12)
Fri Jan  1 00:00:00 UTC 1999

(adding 10^12 for a second because ClockTime is measured in
picoseconds).

Cheers,
	Simon


More information about the Libraries mailing list