19 std::cout <<
"Seconds since epoch: " <<
ts() <<
'\n';
20 std::cout <<
"Milliseconds since epoch: " <<
ts_ms() <<
'\n';
21 std::cout <<
"Microseconds since epoch: " <<
ts_us() <<
'\n';
24 std::cout <<
"Nanosecond part: " <<
ns_of_sec() <<
'\n';
25 std::cout <<
"Microsecond part: " <<
us_of_sec() <<
'\n';
26 std::cout <<
"Millisecond part: " <<
ms_of_sec() <<
'\n';
28 std::cout <<
"CPU time used: " <<
get_cpu_time() <<
" s" <<
'\n';
31 std::cout <<
"Press Enter to exit..." << std::endl;
37 std::cout <<
"time_utils.hpp requires Windows for now_realtime_us()" << std::endl;
Header file with time-related constants.
TIME_SHIELD_CONSTEXPR ts_t ts(year_t year, int month, int day)
Alias for to_timestamp.
constexpr const T ns_of_sec(fts_t ts) noexcept
Get the nanosecond part of the second from a floating-point timestamp.
constexpr ts_ms_t ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
constexpr const T ms_of_sec(fts_t ts) noexcept
Get the millisecond part of the second from a floating-point timestamp.
constexpr const T us_of_sec(fts_t ts) noexcept
Get the microsecond part of the second from a floating-point timestamp.
int64_t now_realtime_us()
Get current real time in microseconds using a hybrid method.
double get_cpu_time() noexcept
Get the CPU time used by the current process.
const ts_us_t ts_us() noexcept
Get the current UTC timestamp in microseconds.
Main namespace for the Time Shield library.
Header file with time-related utility functions.
Type definitions for time-related units and formats.