12 const ts_ms_t utc_ms =
ts_ms(2024, 6, 21, 12, 34, 56, 789);
16 std::cout <<
"ISO8601 local default: " <<
to_iso8601(utc_ts) <<
'\n';
21 std::cout <<
"ISO8601 with offset: " <<
to_iso8601(utc_ts, utc_offset) <<
'\n';
22 std::cout <<
"ISO8601 ms local: " <<
to_iso8601_ms(utc_ms) <<
'\n';
24 std::cout <<
"ISO8601 ms with offset: " <<
to_iso8601_ms(utc_ms, utc_offset) <<
'\n';
27 std::cout <<
"Custom UTC format: "
28 <<
to_string(
"%Y-%m-%d %H:%M:%S", utc_ts) <<
'\n';
29 std::cout <<
"Custom local format: "
30 <<
to_string(
"%Y-%m-%d %H:%M:%S %z", utc_ts, utc_offset) <<
'\n';
31 std::cout <<
"Custom UTC format (ms): "
32 <<
to_string_ms(
"%Y-%m-%d %H:%M:%S.%sss", utc_ms) <<
'\n';
33 std::cout <<
"Custom local fmt (ms): "
34 <<
to_string_ms(
"%Y-%m-%d %H:%M:%S.%sss %z", utc_ms, utc_offset) <<
'\n';
constexpr int64_t SEC_PER_HOUR
Seconds per hour.
constexpr int64_t SEC_PER_MIN
Seconds per minute.
TIME_SHIELD_CONSTEXPR ts_ms_t ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
TIME_SHIELD_CONSTEXPR ts_t to_timestamp(T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
Converts a date and time to a timestamp.
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.
Main namespace for the Time Shield library.