From f76dcfc20f72c45d14d76b2d82f707d0a513d1bb Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 23 Mar 2025 11:32:12 +0000 Subject: Add constants for the common time formats. --- include/timeutils.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') 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. -- cgit v1.3.1-10-gc9f91