|
ORE Studio 0.0.4
|
Utilities for date and time operations. More...
#include <datetime.hpp>

Static Public Member Functions | |
| static std::string | to_iso8601_utc (const std::chrono::system_clock::time_point &tp) |
| Serialises a time point to ISO 8601 UTC string with 'Z' suffix. | |
| static std::chrono::system_clock::time_point | from_iso8601_utc (const std::string &str) |
| Parses an ISO 8601 UTC string to a time point. | |
| static std::string | to_db_string (const std::chrono::system_clock::time_point &tp) |
| Formats a time point as a UTC database timestamp string. | |
| static std::string | to_local_display_string (const std::chrono::system_clock::time_point &tp, const std::string &format=k_timestamp_format) |
| Formats a time point as a human-readable local-time string. | |
Utilities for date and time operations.
Policy: all timestamps are stored and transmitted in UTC. Local time is used only for display. The canonical wire/storage format is ISO 8601 with a 'Z' suffix: "YYYY-MM-DD HH:MM:SSZ".
|
static |
Serialises a time point to ISO 8601 UTC string with 'Z' suffix.
Output format: "YYYY-MM-DD HH:MM:SSZ" Use this for all wire protocol and database writes.
| tp | Time point to format (treated as UTC per C++20 definition). |

|
static |
Parses an ISO 8601 UTC string to a time point.
Accepted UTC designators: 'Z', '+00', '+00:00'. Throws std::invalid_argument if the designator is absent or the offset is non-zero — callers must not pass ambiguous local-time strings.
| str | String to parse. Must include a UTC designator. |
| std::invalid_argument | if the string cannot be parsed or has no UTC designator. |

|
static |
Formats a time point as a UTC database timestamp string.
Output format: "YYYY-MM-DD HH:MM:SS" (no timezone suffix). Use this for embedding timestamps directly in raw SQL statements. Produces the same format as PostgreSQL returns for TIMESTAMPTZ columns when the session timezone is UTC.
| tp | Time point to format (treated as UTC per C++20 definition). |

|
static |
Formats a time point as a human-readable local-time string.
Intended for display only (UI, CLI output). Do NOT use for wire protocol or database writes — use to_iso8601_utc() instead.
| tp | Time point to format. |
| format | strftime format string (default: k_timestamp_format). |