diff options
| author | 2025-03-23 11:32:12 +0000 | |
|---|---|---|
| committer | 2025-03-23 14:40:17 +0000 | |
| commit | f76dcfc20f72c45d14d76b2d82f707d0a513d1bb (patch) | |
| tree | 8a7c3e4517881d6b7ca77d9e1b04c7f14630f0c4 /include | |
| parent | Allow using the long duration format in the xline message. (diff) | |
Add constants for the common time formats.
Diffstat (limited to 'include')
| -rw-r--r-- | include/timeutils.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/timeutils.h b/include/timeutils.h index 5ac185e22..dd6585cfb 100644 --- a/include/timeutils.h +++ b/include/timeutils.h @@ -74,6 +74,18 @@ namespace Duration namespace Time { + /** A short time format picked for being readable (e.g. "Sun 23 Mar 2025 10:20:30") */ + inline constexpr const char* DEFAULT_SHORT = "%a %d %b %Y %H:%M:%S"; + + /** A long time format picked for being readable (e.g. "Sunday, 23 March 2025 @ 10:20:30 GMT"). */ + inline constexpr const char* DEFAULT_LONG = "%A, %d %B %Y @ %H:%M:%S %Z"; + + /** The time format specified in ISO 8601 (e.g. "2025-03-23T10:20:30+0000") */ + inline constexpr const char* ISO_8601 = "%Y-%m-%dT%H:%M:%S%z"; + + /** The time format specified in RFC 1123 (e.g. "Sun, 23 Mar 2025 10:20:30 GMT") */ + inline constexpr const char* RFC_1123 = "%a, %d %b %Y %H:%M:%S %Z"; + /** Converts a UNIX timestamp to a time string. * * @param ts The timestamp to convert to a string. |
