[LEAPSECS] dealing with leap seconds

John Sauter John_Sauter at systemeyescomputerstore.com
Fri Dec 2 12:57:38 EST 2016


On Fri, 2016-12-02 at 11:16 -0500, Steve Summit wrote:

> The other huge, huge difference (also discussed many times)
> is that leap years are handled, while leap seconds are *not*
> handled, by the popular computer time representations that
> we use.  Almost no one who does date and time arithmetic on
> computers ever even worries about leap years, because almost
> everyone converts to a Posix time_t value, does their math in
> seconds, and converts back to a human-readable form at the end.
> But of course it's those same Posix time_t values that deny the
> existence of leap seconds, such that many programmers mistakenly
> imagine that it's impossible for computers to handle leap seconds
> at all, because they don't imagine there's a way of doing date
> and time arithmetic that isn't defined by seconds since the epoch.
> 
> It's possible to devise data structures that do represent UTC
> properly, and that support data and time arithmetic reasonably
> well, but they're a hard sell in the face of the convenience,
> popularity, installed base, and Posix standardization of time_t.
> 
> (I wish this weren't so.  I'm trying to build such a
> representation into the Linux kernel, and for months have thought
> I was *this close* to having it working well enough to announce
> here, but there still seem to be a few more kinks to work out...)
> 
> --scs

I have been working on an application-level set of subroutines
to deal with UTC; perhaps we could work together.  I have also
several times felt I was close to having a complete package, only
to discover some little thing I had missed.  I attach my work so far. 
Currently it doesn't handle conversion between UTC and local time
correctly if the time zone is east of Greenwich and not on a minute
boundary.  My test case is Asia/Tokyo in the 19th century.

I also neglected to think about Daylight Saving Time.

The code is still in Alpha state.  I hope to transition to Beta in
early 2017.
    John Sauter (John_Sauter at systemeyescomputerstore.com)
-- 
PGP fingerprint E24A D25B E5FE 4914 A603  49EC 7030 3EA1 9A0B 511E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avoid_time_t.pdf
Type: application/pdf
Size: 727580 bytes
Desc: not available
URL: <https://pairlist6.pair.net/pipermail/leapsecs/attachments/20161202/47f498b5/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <https://pairlist6.pair.net/pipermail/leapsecs/attachments/20161202/47f498b5/attachment-0001.pgp>


More information about the LEAPSECS mailing list