Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 26 |
Nodes: | 6 (0 / 6) |
Uptime: | 48:57:18 |
Calls: | 632 |
Files: | 1,187 |
D/L today: |
4 files (4,992K bytes) |
Messages: | 177,425 |
#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)
-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 ?
On 9/7/2025 12:57 PM, Bonita Montero wrote:
#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 ?
Tracks the tiny intervals between your clc anti-C posts.