• How to print all days with leap seconds with C++

    From Bonita Montero@3:633/10 to All on Fri Sep 11 19:43:40 2026
    #include <iostream>
    #include <chrono>

    using namespace std;
    using namespace chrono;

    int main()
    {
    for( int yr = 1972; yr < 2035; ++yr )
    for( int dec31 = 0; dec31 <= 1; ++dec31 )
    {
    year_month_day ymd = year( yr + dec31 ) / month( dec31 ? 1 : 7 ) /
    day( 1 );
    system_clock::time_point
    tpAfter = sys_days( ymd ),
    tpBefore = tpAfter - system_clock::duration( 1 );
    utc_clock::time_point
    utcBefore = utc_clock::from_sys( tpBefore ),
    utcAfter = utc_clock::from_sys( tpAfter );
    if( utcAfter - utcBefore >= 1s )
    cout << yr << " / " << (dec31 ? "december" : "june") << endl;
    }
    }

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Scott Lurndal@3:633/10 to All on Fri Sep 11 18:21:50 2026
    Bonita Montero <Bonita.Montero@gmail.com> writes:

    int main()
    {
    for( int yr = 1972; yr < 2035; ++yr )

    1. Might as well stop at 2026, as there will likely be no
    additional leap seconds added after that [*]

    2. On 64-bit linux, time_t is 64_bits; stopping at 2034
    is only meaningful for 32-bit time_t.

    [*]<https://www.theregister.com/offbeat/2026/09/06/time-lords-prepare-to-kick-leap-seconds-into-the-next-millennium/5294538>


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Bonita Montero@3:633/10 to All on Sat Sep 12 05:18:21 2026
    Am 11.09.2026 um 20:21 schrieb Scott Lurndal:
    Bonita Montero <Bonita.Montero@gmail.com> writes:

    int main()
    {
    for( int yr = 1972; yr < 2035; ++yr )

    1. Might as well stop at 2026, as there will likely be no
    additional leap seconds added after that [*]

    2. On 64-bit linux, time_t is 64_bits; stopping at 2034
    is only meaningful for 32-bit time_t.
    There will be no more leap seconds from 2035 on.


    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)