• Re: New clock !

    From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c,comp.lang.c++ on Sun Sep 7 19:28:58 2025
    From Newsgroup: comp.lang.c++

    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a #include <time.h>
    #else
    -a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a using rep = int64_t;
    -a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a using duration = std::chrono::duration<rep, period>;
    -a-a-a using time_point = std::chrono::time_point<win_time, duration>;
    -a-a-a static time_point now() noexcept;
    -a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a static constexpr int64_t UNIX_START = 116444736000000000;
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a FILETIME ft;
    -a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a timespec ts;
    -a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec * 10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration( 116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds( ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From wij@wyniijj5@gmail.com to comp.lang.c++ on Mon Sep 8 05:04:10 2025
    From Newsgroup: comp.lang.c++

    On Sun, 2025-09-07 at 19:28 +0200, Bonita Montero wrote:
    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a-a #include <time.h>
    #else
    -a-a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a-a using rep = int64_t;
    -a-a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a-a using duration = std::chrono::duration<rep, period>;
    -a-a-a-a using time_point = std::chrono::time_point<win_time, duration>; -a-a-a-a static time_point now() noexcept;
    -a-a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a-a static constexpr int64_t UNIX_START = 116444736000000000;
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a-a FILETIME ft;
    -a-a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a-a timespec ts;
    -a-a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec * 10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration( 116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds( ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }
    Typical problems of C++ program are demonstrated.
    But first, what the purpose of win_time?
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Sun Sep 7 23:22:56 2025
    From Newsgroup: comp.lang.c++

    Am 07.09.2025 um 23:04 schrieb wij:
    On Sun, 2025-09-07 at 19:28 +0200, Bonita Montero wrote:
    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a-a #include <time.h>
    #else
    -a-a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a-a using rep = int64_t;
    -a-a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a-a using duration = std::chrono::duration<rep, period>;
    -a-a-a-a using time_point = std::chrono::time_point<win_time, duration>; >>> -a-a-a-a static time_point now() noexcept;
    -a-a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a-a static constexpr int64_t UNIX_START = 116444736000000000;
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a-a FILETIME ft;
    -a-a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | >>> ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a-a timespec ts;
    -a-a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec * >>> 10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration(
    116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds(
    ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }

    Typical problems of C++ program are demonstrated.
    But first, what the purpose of win_time?


    Problems with auch a few lines of code - idiot !
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From wij@wyniijj5@gmail.com to comp.lang.c++ on Mon Sep 8 19:46:52 2025
    From Newsgroup: comp.lang.c++

    On Sun, 2025-09-07 at 23:22 +0200, Bonita Montero wrote:
    Am 07.09.2025 um 23:04 schrieb wij:
    On Sun, 2025-09-07 at 19:28 +0200, Bonita Montero wrote:
    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a-a-a #include <time.h>
    #else
    -a-a-a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a-a-a using rep = int64_t;
    -a-a-a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a-a-a using duration = std::chrono::duration<rep, period>; -a-a-a-a-a using time_point = std::chrono::time_point<win_time, duration>;
    -a-a-a-a-a static time_point now() noexcept;
    -a-a-a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a-a-a static constexpr int64_t UNIX_START = 116444736000000000;
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a-a-a FILETIME ft;
    -a-a-a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a-a-a timespec ts;
    -a-a-a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec *
    10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration( 116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds( ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }

    Typical problems of C++ program are demonstrated.
    But first, what the purpose of win_time?


    Problems with auch a few lines of code - idiot !
    You simplified the problem you were dealing with, not really the programming. Also, from my always-check-errors policy, you missed the checking for errors-a and 'noexcept' of now() is problematic.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Wed Sep 10 00:05:38 2025
    From Newsgroup: comp.lang.c++

    Am 08.09.2025 um 13:46 schrieb wij:
    On Sun, 2025-09-07 at 23:22 +0200, Bonita Montero wrote:
    Am 07.09.2025 um 23:04 schrieb wij:
    On Sun, 2025-09-07 at 19:28 +0200, Bonita Montero wrote:
    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a-a-a #include <time.h>
    #else
    -a-a-a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a-a-a using rep = int64_t;
    -a-a-a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a-a-a using duration = std::chrono::duration<rep, period>;
    -a-a-a-a-a using time_point = std::chrono::time_point<win_time, duration>;
    -a-a-a-a-a static time_point now() noexcept;
    -a-a-a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a-a-a static constexpr int64_t UNIX_START = 116444736000000000; >>>>> };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a-a-a FILETIME ft;
    -a-a-a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a-a-a timespec ts;
    -a-a-a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec *
    10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration(
    116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds(
    ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }

    Typical problems of C++ program are demonstrated.
    But first, what the purpose of win_time?


    Problems with auch a few lines of code - idiot !

    You simplified the problem you were dealing with, not really the programming.

    Also, from my always-check-errors policy, you missed the checking for errors and 'noexcept' of now() is problematic.


    ::now() is noexcept with C++ in general. So if C++ itself isn't dealing
    with errors fot that actually never fails. AnGetSystemTimePreciseAs
    FileTime() has no error code at all.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From wij@wyniijj5@gmail.com to comp.lang.c++ on Thu Sep 11 10:08:11 2025
    From Newsgroup: comp.lang.c++

    On Wed, 2025-09-10 at 00:05 +0200, Bonita Montero wrote:
    Am 08.09.2025 um 13:46 schrieb wij:
    On Sun, 2025-09-07 at 23:22 +0200, Bonita Montero wrote:
    Am 07.09.2025 um 23:04 schrieb wij:
    On Sun, 2025-09-07 at 19:28 +0200, Bonita Montero wrote:
    Oh, wrong group.

    Am 07.09.2025 um 18:57 schrieb Bonita Montero:
    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    -a-a-a-a-a-a #include <Windows.h>
    #elif defined(__unix__)
    -a-a-a-a-a-a #include <time.h>
    #else
    -a-a-a-a-a-a #error dasdasd
    #endif

    struct win_time
    {
    -a-a-a-a-a-a using rep = int64_t;
    -a-a-a-a-a-a using period = std::ratio<1, 10000000>;
    -a-a-a-a-a-a using duration = std::chrono::duration<rep, period>; -a-a-a-a-a-a using time_point = std::chrono::time_point<win_time, duration>;
    -a-a-a-a-a-a static time_point now() noexcept;
    -a-a-a-a-a-a static constexpr bool is_steady = true;
    private:
    -a-a-a-a-a-a static constexpr int64_t UNIX_START = 116444736000000000;
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    -a-a-a-a-a-a FILETIME ft;
    -a-a-a-a-a-a GetSystemTimePreciseAsFileTime( &ft );
    -a-a-a-a-a-a return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    -a-a-a-a-a-a timespec ts;
    -a-a-a-a-a-a clock_gettime( CLOCK_REALTIME, &ts );
    -a-a-a-a-a-a return time_point( duration( UNIX_START + (uint64_t)ts.tv_sec *
    10'000'000u + ((uint64_t)ts.tv_nsec + 50u) / 100u ) );
    #endif
    }

    What does this do ?

    #pragma once
    #include <cstdint>
    #include <chrono>
    #if defined(_WIN32)
    #include <Windows.h>
    #elif defined(__unix__)
    #include <time.h>
    #else
    #error dasdasd
    #endif

    struct win_time
    {
    using rep = int64_t;
    using period = std::ratio<1, 10000000>;
    using duration = std::chrono::duration<rep, period>;
    using time_point = std::chrono::time_point<win_time, duration>;
    static time_point now() noexcept;
    static constexpr bool is_steady = false;
    private:
    static constexpr time_point UNIX_START = time_point( duration( 116444736000000000 ) );
    };

    inline win_time::time_point win_time::now() noexcept
    {
    #if defined(_WIN32)
    FILETIME ft;
    GetSystemTimePreciseAsFileTime( &ft );
    return time_point( duration( (uint64_t)ft.dwHighDateTime << 32 |
    ft.dwLowDateTime ) );
    #elif defined(__unix__)
    using namespace std::chrono;
    timespec ts;
    clock_gettime( CLOCK_REALTIME, &ts );
    return UNIX_START + duration_cast<win_time::duration>( seconds( ts.tv_sec ) + nanoseconds( ts.tv_nsec + 50 ) );
    #endif
    }

    Typical problems of C++ program are demonstrated.
    But first, what the purpose of win_time?


    Problems with auch a few lines of code - idiot !

    You simplified the problem you were dealing with, not really the programming.

    Also, from my always-check-errors policy, you missed the checking for errors
    and 'noexcept' of now() is problematic.


    ::now() is noexcept with C++ in general. So if C++ itself isn't dealing
    with errors fot that actually never fails. AnGetSystemTimePreciseAs FileTime() has no error code at all.
    I won't say too much.
    Your implement contains possible abnormal termination.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Thu Sep 11 05:33:06 2025
    From Newsgroup: comp.lang.c++

    Am 11.09.2025 um 04:08 schrieb wij:

    I won't say too much.
    Your implement contains possible abnormal termination.

    The implementation of all clocks of the runtime also.

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Bonita Montero@Bonita.Montero@gmail.com to comp.lang.c++ on Fri Oct 10 03:26:14 2025
    From Newsgroup: comp.lang.c++

    This is the current code to convert a time_point with 100ns-ticks
    since 1.1.1601 00:00:00.0 to a date in Gregorian or Julian calendar.

    template<bool Gregorian>
    void date_1601<Gregorian>::from_time_point( time_point timePoint ) noexcept
    {
    uint64_t tsCalc = timePoint.time_since_epoch().count();
    bool leapYear = false;
    constexpr int64_t Y4S = FOUR_YEARS_W_LY;
    int y400 = 0, y100 = 0, y4, yMod4, patch = 0;
    bool leapQuad = true;
    if constexpr( Gregorian )
    {
    constexpr int64_t Y400S = FOUR_HUNDRED_YEARS;
    if( (int64_t)tsCalc >= -(int64_t)LEAP_YEAR )
    {
    if( (int64_t)(tsCalc + LEAP_YEAR) < (int64_t)tsCalc )
    {
    tsCalc -= FOUR_HUNDRED_YEARS;
    patch = 400;
    }
    tsCalc += LEAP_YEAR;
    y400 += (int)(tsCalc / FOUR_HUNDRED_YEARS);
    }
    else
    {
    tsCalc += LEAP_YEAR;
    if( (int64_t)tsCalc <= -Y400S )
    {
    tsCalc += FOUR_HUNDRED_YEARS;
    patch = -400;
    }
    y400 += (int)((int64_t)(tsCalc - (Y400S - 1)) / Y400S);
    }
    tsCalc -= y400 * Y400S;
    if( tsCalc >= FIRST_CENTURY )
    {
    y100 = (int)((tsCalc - FIRST_CENTURY) / REMAINING_CENUTRIES); // 0 ... 2
    tsCalc -= FIRST_CENTURY + y100++ * REMAINING_CENUTRIES; // -> 1 ... 3
    if( tsCalc >= FOUR_YEARS_WO_LY )
    {
    y4 = (int)((tsCalc - FOUR_YEARS_WO_LY) / FOUR_YEARS_W_LY); // 0 ... 23
    tsCalc -= FOUR_YEARS_WO_LY + y4++ * FOUR_YEARS_W_LY; // -> 1 ... 24
    }
    else
    {
    y4 = 0;
    yMod4 = (int)(tsCalc / NON_LEAP_YEAR);
    tsCalc -= yMod4 * NON_LEAP_YEAR;
    leapQuad = false;
    }
    }
    else
    {
    y100 = 0;
    y4 = (int)(tsCalc / FOUR_YEARS_W_LY);
    tsCalc -= y4 * FOUR_YEARS_W_LY;
    }
    }
    else
    {
    if( (int64_t)tsCalc >= -(int64_t)JULIAN_ZERO_1600 )
    {
    if( (int64_t)(tsCalc + JULIAN_ZERO_1600) < (int64_t)tsCalc )
    {
    tsCalc -= FOUR_YEARS_W_LY;
    patch = 4;
    }
    tsCalc += JULIAN_ZERO_1600;
    y4 = (int)(tsCalc / FOUR_YEARS_W_LY);
    }
    else
    {
    tsCalc += JULIAN_ZERO_1600;
    if( (int64_t)tsCalc <= -Y4S )
    {
    tsCalc += FOUR_YEARS_W_LY;
    patch = -4;
    }
    y4 = (int)((int64_t)(tsCalc - (Y4S - 1)) / Y4S);
    }
    tsCalc -= y4 * Y4S;
    }
    if( leapQuad )
    if( leapYear = tsCalc < LEAP_YEAR; !leapYear )
    {
    tsCalc -= LEAP_YEAR;
    yMod4 = (int)(tsCalc / NON_LEAP_YEAR); // 0 ... 2
    tsCalc -= yMod4++ * NON_LEAP_YEAR; // -> 1 ... 3
    }
    else
    yMod4 = 0;
    year = (int16_t)(1600 + 400 * y400 + 100 * y100 + 4 * y4 + yMod4 + patch);
    {
    uint16_t yDay = (uint16_t)(tsCalc / DAY);
    tsCalc %= DAY;
    span dualDaysAfterYear( g_daysAfterYear );
    span daysAfterYear( dualDaysAfterYear[leapYear] );
    month = 0;
    for( ; yDay >= daysAfterYear[month + 1]; ++month );
    assert(month < 12);
    day = yDay - daysAfterYear[month] + 1;
    ++month;
    }
    hour = (uint8_t)(tsCalc / HOUR);
    tsCalc %= HOUR;
    minute = (uint8_t)(tsCalc / MINUTE);
    tsCalc %= MINUTE;
    second = (uint8_t)((uint32_t)tsCalc / (uint32_t)SECOND);
    ticks = (uint32_t)tsCalc % (uint32_t)SECOND;
    weekday = get_weekday( timePoint );
    }
    --- Synchronet 3.21a-Linux NewsLink 1.2