|
ITCH 5.0 Market Data Handler 1.0.0
NASDAQ ITCH 5.0 Market Data Feed Handler
|
High-resolution monotonic clock. More...
High-resolution monotonic clock.
Provides high-resolution time measurements using platform-specific performance counters. The clock is monotonic (never goes backwards) and provides much higher precision than std::chrono::system_clock.
Key characteristics:
The clock stores time as raw counter ticks. Use duration_cast() to convert to standard time units (seconds, milliseconds, nanoseconds, etc.).
#include <core/src/HRClock.h>
Public Types | |
| using | TimePoint = uint64_t |
| Time point type (raw counter ticks as 64-bit unsigned integer). | |
| using | Duration = int64_t |
| Duration type (signed 64-bit for differences and negative values). | |
Static Public Member Functions | |
| static TimePoint | now () noexcept |
| Get current time point. | |
| static uint64_t | frequency () noexcept |
| Get clock frequency (ticks per second). | |
| template<class D> | |
| static D | duration_cast (Duration d) noexcept |
| Convert clock duration to std::chrono duration. | |
| template<class D> | |
| static Duration | duration_cast (const D d) noexcept |
| Convert std::chrono duration to clock duration. | |
| template<class D> | |
| static D | elapsed (TimePoint t) noexcept |
| Calculate elapsed time since a time point. | |
| using b2bits::HRClock::Duration = int64_t |
Duration type (signed 64-bit for differences and negative values).
| using b2bits::HRClock::TimePoint = uint64_t |
Time point type (raw counter ticks as 64-bit unsigned integer).
|
inlinestaticnoexcept |
Convert std::chrono duration to clock duration.
Converts a standard C++ duration type to raw clock ticks. This is the inverse operation of duration_cast(Duration).
| D | std::chrono::duration type (e.g., std::chrono::milliseconds) |
| d | Duration in chrono type |
References frequency().
|
inlinestaticnoexcept |
Convert clock duration to std::chrono duration.
Converts a raw tick duration to a standard C++ duration type (e.g., std::chrono::milliseconds, std::chrono::nanoseconds).
Uses the clock frequency to perform accurate conversion with rounding.
| D | std::chrono::duration type (e.g., std::chrono::nanoseconds) |
| d | Duration in clock ticks |
References duration_cast(), and frequency().
Referenced by duration_cast(), and elapsed().
|
inlinestaticnoexcept |
Calculate elapsed time since a time point.
Computes the elapsed time from a previous time point to now, returning the result in the specified duration type.
Equivalent to: duration_cast<D>(now() - t)
| D | std::chrono::duration type for result |
| t | Previous time point to measure from |
References duration_cast(), and now().
|
staticnoexcept |
Get clock frequency (ticks per second).
Returns the number of clock ticks per second. This is used to convert raw tick counts to standard time units.
References frequency().
Referenced by duration_cast(), duration_cast(), and frequency().
|
staticnoexcept |
Get current time point.
Returns the current value of the high-resolution performance counter. The value is in platform-specific ticks (not directly in seconds or nanoseconds).
Referenced by elapsed().