<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 2, 2016 at 11:47 AM, Howard Hinnant <span dir="ltr"><<a href="mailto:howard.hinnant@gmail.com" target="_blank">howard.hinnant@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sep 2, 2016, at 11:42 AM, Bradley White <<a href="mailto:bww@acm.org">bww@acm.org</a>> wrote:<br>
><br>
> 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.<br>
<br>
</span>This may be your only use of the leap-second table, but it is not my use.<br>
<br>
Here is working code for me:<br>
<br>
    #include "chrono_io.h"<br>
    #include "tz.h"<br>
    #include <iostream><br>
<br>
    int<br>
    main()<br>
    {<br>
        using namespace date;<br>
        using namespace std::chrono_literals;<br>
        auto t0 = to_gps_time(sys_days{2017_y/<wbr>jan/1} - 500ms);<br>
        auto t1 = to_gps_time(sys_days{2017_y/<wbr>jan/1} + 500ms);<br>
        std::cout << t1 - t0 << '\n';<br>
    }<br>
<br>
This should output:<br>
<br>
    2000ms<br>
<br>
which indicates the insertion of a leap second into my gps_clock a few months from now.  Unfortunately it currently (and incorrectly) outputs:<br>
<br>
    1000ms<br></blockquote><div><br></div><div>Sure, you may use *a* leap-second table.  But tzdata only includes one to generate "right" zoneinfo files.</div><div><br></div><div>Aside: It would be unfortunate, for any expression X, if ((X + 500ms) - (X - 500ms)) was not 1000ms.</div></div></div></div>