Time Shield Library
C++ library for working with time
|
Utility functions for working with timestamps and time components. More...
Functions | |
const 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 hybrid method. | |
template<class T = int> | |
const T | time_shield::ns_of_sec () noexcept |
Get the nanosecond part of the current second. | |
template<class T = int> | |
const T | time_shield::us_of_sec () noexcept |
Get the microsecond part of the current second. | |
template<class T = int> | |
const T | time_shield::ms_of_sec () noexcept |
Get the millisecond part of the current second. | |
const ts_t | time_shield::timestamp () noexcept |
Get the current UTC timestamp in seconds. | |
const fts_t | time_shield::fts () noexcept |
Get the current UTC timestamp in floating-point seconds. | |
const fts_t | time_shield::ftimestamp () noexcept |
Get the current UTC timestamp in floating-point seconds. | |
const ts_ms_t | time_shield::ts_ms () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_ms_t | time_shield::timestamp_ms () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_ms_t | time_shield::now () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_us_t | time_shield::ts_us () noexcept |
Get the current UTC timestamp in microseconds. | |
const 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. | |
const 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 147 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in floating-point seconds.
Definition at line 139 of file time_utils.hpp.
|
inlinenoexcept |
Get the CPU time used by the current process.
Definition at line 197 of file time_utils.hpp.
|
inlinenoexcept |
Get the current timespec.
Definition at line 35 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.
int time_shield::ms_of_sec | ( | ) |
Get the millisecond part of the current second.
Definition at line 63 of file time_utils.mqh.
|
noexcept |
Get the millisecond part of the current second.
T | Type of the returned value (default is int). |
Definition at line 116 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 171 of file time_utils.hpp.
|
inline |
Get current real time in microseconds using a hybrid method.
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).
Definition at line 55 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 96 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 131 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 163 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 187 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in seconds.
Definition at line 123 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Definition at line 155 of file time_utils.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in microseconds.
Definition at line 179 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.
|
noexcept |
Get the microsecond part of the current second.
T | Type of the returned value (default is int). |
Definition at line 106 of file time_utils.hpp.