[Haskell-cafe] Parsing LocalTime from Unix seconds

Viktor Dukhovni ietf-dane at dukhovni.org
Mon Sep 17 13:12:38 UTC 2018



> On Sep 17, 2018, at 2:01 AM, Tobias Dammers <tdammers at gmail.com> wrote:
> 
> Also, unix time may represent either actual seconds elapsed since epoch, or
> "logical" seconds since epoch (ignoring leap seconds, such that midnight
> is always a multiple of 86400 seconds).

That would be a violation of the specification:

  http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16

On all extant systems Unix Time is based on an 86400-second day, regardless
of any leap seconds.  The RTC clock has nothing to do with this, the epoch
time is defined as an interval.  It only becomes fuzzy when leap seconds
are being handled, as different systems may handle the leap second in somewhat
different ways.  Since the epoch time is quantized anyhow to a 1s granularity,
you can expect the epoch time reported by different systems to differ by +/-1s
normally, even with clocks reasonably well synchronized, and +/-2s when leap
seconds are being added if they're not both using the same adjustment algorithm
(say NTP leap second smearing).

-- 
	Viktor.



More information about the Haskell-Cafe mailing list