Skip Menu |
Report information
Id: 126121
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: zefram [at]

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)

Subject: [BUG] Instant.from-posix has faulty pre-1972 leap second knowledge
To: rakudobug [...]
From: Zefram <zefram [...]>
Date: Sun, 20 Sep 2015 18:36:18 +0100
Download (untitled) / with headers
text/plain 1.7k
Reusing the function I explained in [perl #126119], let's look at 1970: $ ./perl6 -e 'sub leaps-between ($a, $b) { (Instant.from-posix($b) - Instant.from-posix($a)) - ($b - $a) }; say leaps-between(0, 31536000)' 0 No leaps. Is that right? Not really. In 1970 there were no leap seconds of the modern type. But UTC was not moving in lockstep with TAI, the way it does in a modern leapless year such as 2014. In fact, for the whole of 1970, each UTC second lasted exactly 1.00000003 TAI seconds. This is in the so-called "rubber seconds" era of UTC. So the 31536000 UTC seconds of 1970 lasted exactly 31536000.94608 TAI seconds, and so the leaps-between function ought to reflect that by returning a value of exactly 0.94608 s for this interval. Similar considerations apply throughout the period from 1961-01-01 to 1972-01-01. In this era, the UTC second had a length slightly offset from that of the TAI second, the offset being occasionally changed at the start of a year. There were also instantaneous leaps, of almost the modern form, always at the end of a month and by some fraction of a second. See <> for defining expressions. However, this analysis depends on strictly interpreting POSIX time_t values, for the purposes of Instant.from-posix() as being based on UTC. This is what the POSIX standard says, but it doesn't match historical Unix practice of the era. If the input to Instant.from-posix() is to be interpreted more loosely, then tai-utc.dat is not directly applicable. But that doesn't get you off the hook: the loose interpretation is still that time_t values are based on some form of UT, and so it still needs to show leaps relative to TAI. The difference is that you have greater freedom in choosing the details of the leaps. -zefram

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at