[tz] tzdata for 2016 leap seconds

Howard Hinnant howard.hinnant at gmail.com
Fri Sep 2 15:47:17 UTC 2016


On Sep 2, 2016, at 11:42 AM, Bradley White <bww at acm.org> wrote:
> 
> Just to clarify, the leap-second table in the tzdata is only for running in "right" mode, where clocks tick through leaps and so don't need any indication that leaps happen.

This may be your only use of the leap-second table, but it is not my use.

Here is working code for me:

    #include "chrono_io.h"
    #include "tz.h"
    #include <iostream>

    int
    main()
    {
        using namespace date;
        using namespace std::chrono_literals;
        auto t0 = to_gps_time(sys_days{2017_y/jan/1} - 500ms);
        auto t1 = to_gps_time(sys_days{2017_y/jan/1} + 500ms);
        std::cout << t1 - t0 << '\n';
    }

This should output:

    2000ms

which indicates the insertion of a leap second into my gps_clock a few months from now.  Unfortunately it currently (and incorrectly) outputs:

    1000ms

Howard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mm.icann.org/pipermail/tz/attachments/20160902/4a7a79a3/attachment.sig>


More information about the tz mailing list