12 const std::chrono::system_clock::time_point
now = std::chrono::system_clock::now();
13 const ts_t now_sec =
static_cast<ts_t>(std::chrono::system_clock::to_time_t(
now));
15 std::chrono::duration_cast<std::chrono::milliseconds>(
now.time_since_epoch()).count());
18 std::cout <<
"ISO8601 UTC: " <<
to_iso8601(now_sec) <<
'\n';
19 std::cout <<
"ISO8601 UTC (ms): " <<
to_iso8601_ms(now_ms) <<
'\n';
20 std::cout <<
"ISO8601 with offset: " <<
to_iso8601(now_sec, utc_offset) <<
'\n';
21 std::cout <<
"Custom UTC format: "
22 <<
to_string(
"%Y-%m-%d %H:%M:%S", now_sec) <<
'\n';
23 std::cout <<
"Custom local format: "
24 <<
to_string(
"%Y-%m-%d %H:%M:%S %z", now_sec, utc_offset) <<
'\n';
constexpr int64_t SEC_PER_HOUR
Seconds per hour.
constexpr int64_t SEC_PER_MIN
Seconds per minute.
int64_t ts_t
Unix timestamp in seconds since 1970‑01‑01T00:00:00Z.
int32_t tz_t
Time zone offset in minutes from UTC (e.g., +180 = UTC+3).
int64_t ts_ms_t
Unix timestamp in milliseconds since epoch.
ts_ms_t now() noexcept
Get the current UTC timestamp in milliseconds.
Main namespace for the Time Shield library.