[time-nuts] Time math libraries

Eric Scace eric at scace.org
Mon Dec 12 13:45:08 EST 2016


   (Apologies if this question has been addressed before. Archive search is rather cumbersome on a month-by-month basis.)

   Few people will be surprised to learn that MS Excel does not account for leap seconds when doing time math. See below for an example. This is just an example of many instances of programming failures.

   Are there good time math software libraries (e.g., Java, C++/C#, etc) that will do time math correctly for the chosen time scale?

   Thanks.

— Eric


2016 Dec 31 Sat 23:59:57
2016 Dec 31 Sat 23:59:58
2016 Dec 31 Sat 23:59:59
2017 Jan 01 Sun 00:00:00
2017 Jan 01 Sun 00:00:01
2017 Jan 01 Sun 00:00:02


My machine is on EST right now. Is it a time zone question?

2016 Dec 31 Sat 18:59:57
2016 Dec 31 Sat 18:59:58
2016 Dec 31 Sat 18:59:59
2016 Dec 31 Sat 19:00:00
2016 Dec 31 Sat 19:00:01
2016 Dec 31 Sat 19:00:02

Nope!

What about past leap seconds?

2015 Jun 30 Tue 23:59:57
2015 Jun 30 Tue 23:59:58
2015 Jun 30 Tue 23:59:59
2015 Jul 01 Wed 00:00:00
2015 Jul 01 Wed 00:00:01
2015 Jul 01 Wed 00:00:02

Also fail!


More information about the time-nuts mailing list