aboutsummaryrefslogtreecommitdiff
path: root/lib/time
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-23 19:28:08 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-23 19:28:08 -0400
commitfcda36561d668f43bac91ea31cd55cbbd605d330 (patch)
treeeb74c0b17df584af0fd8154422ad924e04c96cc2 /lib/time
parent414b0c7472c87c5a013029aefef49e2dbc41e700 (diff)
Autoformat everything with clang-format
Diffstat (limited to 'lib/time')
-rw-r--r--lib/time/time_defs.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/time/time_defs.h b/lib/time/time_defs.h
index 2ae1d9e4..214c26b9 100644
--- a/lib/time/time_defs.h
+++ b/lib/time/time_defs.h
@@ -7,25 +7,26 @@ typedef struct timeval Time;
static OptionalText_t _local_timezone = NONE_TEXT;
-static INLINE Text_t num_format(long n, const char *unit)
-{
- if (n == 0)
- return Text("now");
- return Text$from_str(String((int64_t)labs(n), " ", unit, (n == -1 || n == 1) ? "" : "s", n <= 0 ? " ago" : " later"));
+static INLINE Text_t num_format(long n, const char *unit) {
+ if (n == 0) return Text("now");
+ return Text$from_str(
+ String((int64_t)labs(n), " ", unit, (n == -1 || n == 1) ? "" : "s", n <= 0 ? " ago" : " later"));
}
-static void set_local_timezone(Text_t tz)
-{
+static void set_local_timezone(Text_t tz) {
setenv("TZ", Text$as_c_string(tz), 1);
_local_timezone = tz;
tzset();
}
-#define WITH_TIMEZONE(tz, body) ({ if (tz.length >= 0) { \
- OptionalText_t old_timezone = _local_timezone; \
- set_local_timezone(tz); \
- body; \
- set_local_timezone(old_timezone); \
- } else { \
- body; \
- }})
+#define WITH_TIMEZONE(tz, body) \
+ ({ \
+ if (tz.length >= 0) { \
+ OptionalText_t old_timezone = _local_timezone; \
+ set_local_timezone(tz); \
+ body; \
+ set_local_timezone(old_timezone); \
+ } else { \
+ body; \
+ } \
+ })