|
Time Shield Library
C++ library for working with time
|
Utility functions for working with timestamps and time components. More...
Classes | |
| class | time_shield::CpuTickTimer |
| Timer that measures CPU time ticks using get_cpu_time(). More... | |
Functions | |
| struct timespec | time_shield::get_timespec_impl () noexcept |
| Get the current timespec. | |
| int64_t | time_shield::now_realtime_us () |
| Get current real time in microseconds using a platform-specific method. | |
| ts_t | time_shield::monotonic_sec () noexcept |
| Return monotonic seconds from a process-local reference. | |
| ts_ms_t | time_shield::monotonic_ms () noexcept |
| Return monotonic milliseconds from a process-local reference. | |
| ts_us_t | time_shield::monotonic_us () noexcept |
| Return monotonic microseconds from a process-local reference. | |
| template<class T = int> | |
| T | time_shield::ns_of_sec () noexcept |
| Get the nanosecond part of the current second. | |
| template<class T = int> | |
| T | time_shield::us_of_sec () noexcept |
| Get the microsecond part of the current second. | |
| template<class T = int> | |
| T | time_shield::ms_of_sec () noexcept |
| Get the millisecond part of the current second. | |
| ts_t | time_shield::timestamp () noexcept |
| Get the current UTC timestamp in seconds. | |
| fts_t | time_shield::fts () noexcept |
| Get the current UTC timestamp in floating-point seconds. | |
| fts_t | time_shield::ftimestamp () noexcept |
| Get the current UTC timestamp in floating-point seconds. | |
| ts_ms_t | time_shield::ts_ms () noexcept |
| Get the current UTC timestamp in milliseconds. | |
| ts_ms_t | time_shield::timestamp_ms () noexcept |
| Get the current UTC timestamp in milliseconds. | |
| ts_ms_t | time_shield::now () noexcept |
| Get the current UTC timestamp in milliseconds. | |
| ts_us_t | time_shield::ts_us () noexcept |
| Get the current UTC timestamp in microseconds. | |
| ts_us_t | time_shield::timestamp_us () noexcept |
| Get the current UTC timestamp in microseconds. | |
| double | time_shield::get_cpu_time () noexcept |
| Get the CPU time used by the current process. | |
| long | time_shield::microseconds () |
| Get the number of microseconds since the UNIX epoch. | |
| long | time_shield::ns_of_sec () |
| Get the nanosecond part of the current second. | |
| int | time_shield::us_of_sec () |
| Get the microsecond part of the current second. | |
| int | time_shield::ms_of_sec () |
| Get the millisecond part of the current second. | |
| ts_t | time_shield::ts () noexcept |
| Get the current UTC timestamp in seconds. | |
Utility functions for working with timestamps and time components.
A collection of utility functions for working with timestamps and time components.
This module provides functions for obtaining the current timestamps in various formats (e.g., seconds, milliseconds, microseconds, floating-point seconds) and extracting sub-second components such as nanoseconds, microseconds, and milliseconds.
|
inlinenoexcept |
Get the current UTC timestamp in floating-point seconds.
Alias for fts().
Get the current UTC timestamp in floating-point seconds.
Definition at line 234 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in floating-point seconds.
Definition at line 226 of file time_utils.hpp.
|
inlinenoexcept |
Get the CPU time used by the current process.
Definition at line 284 of file time_utils.hpp.
|
inlinenoexcept |
Get the current timespec.
Definition at line 40 of file time_utils.hpp.
| long time_shield::microseconds | ( | ) |
Get the number of microseconds since the UNIX epoch.
Definition at line 32 of file time_utils.mqh.
|
inlinenoexcept |
Return monotonic milliseconds from a process-local reference.
Uses std::chrono::steady_clock and returns an opaque monotonic value that is only suitable for measuring intervals and deadlines.
Definition at line 161 of file time_utils.hpp.
|
inlinenoexcept |
Return monotonic seconds from a process-local reference.
Uses std::chrono::steady_clock and returns an opaque monotonic value that is only suitable for measuring intervals and deadlines.
Definition at line 149 of file time_utils.hpp.
|
inlinenoexcept |
Return monotonic microseconds from a process-local reference.
Uses std::chrono::steady_clock and returns an opaque monotonic value that is only suitable for measuring intervals and deadlines.
Definition at line 173 of file time_utils.hpp.
| int time_shield::ms_of_sec | ( | ) |
Get the millisecond part of the current second.
Definition at line 63 of file time_utils.mqh.
|
inlinenoexcept |
Get the millisecond part of the current second.
| T | Type of the returned value (default is int). |
Definition at line 203 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Alias for ts_ms().
Get the current UTC timestamp in milliseconds.
Definition at line 258 of file time_utils.hpp.
|
inline |
Get current real time in microseconds using a platform-specific method.
On Windows this function combines QueryPerformanceCounter (high-resolution monotonic clock) with GetSystemTimeAsFileTime to compute an accurate, stable UTC timestamp. The base time is initialized only once per process (lazy init). On Unix-like systems a realtime anchor is captured once and combined with a high-resolution monotonic clock to compute stable timestamps.
Definition at line 61 of file time_utils.hpp.
| long time_shield::ns_of_sec | ( | ) |
Get the nanosecond part of the current second.
Definition at line 51 of file time_utils.mqh.
|
inlinenoexcept |
Get the nanosecond part of the current second.
| T | Type of the returned value (default is int). |
Definition at line 183 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in seconds.
Alias for ts().
Get the current UTC timestamp in seconds.
Definition at line 218 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Alias for ts_ms().
Get the current UTC timestamp in milliseconds.
Definition at line 250 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in microseconds.
Alias for ts_us().
Get the current UTC timestamp in microseconds.
Definition at line 274 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in seconds.
Definition at line 210 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Definition at line 242 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in microseconds.
Definition at line 266 of file time_utils.hpp.
| int time_shield::us_of_sec | ( | ) |
Get the microsecond part of the current second.
Definition at line 57 of file time_utils.mqh.
|
inlinenoexcept |
Get the microsecond part of the current second.
| T | Type of the returned value (default is int). |
Definition at line 193 of file time_utils.hpp.