summaryrefslogtreecommitdiffstats
path: root/src/basic/time-util.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-10-15 17:33:04 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-10-20 08:51:48 +0200
commit67bd5620f6cf481c0a59cedbcf63ddcab355cc55 (patch)
treee7aafd7a176377f9c4a1100a7e304ac32f05399f /src/basic/time-util.h
parentMerge pull request #16939 from Rahix/robust-first-boot-machine-id (diff)
downloadsystemd-67bd5620f6cf481c0a59cedbcf63ddcab355cc55.tar.xz
systemd-67bd5620f6cf481c0a59cedbcf63ddcab355cc55.zip
util: make size macros unsigned
By making them unsigned comparing them with other sizes is less likely to trigger compiler warnings regarding signed/unsigned comparisons. After all sizes (i.e. size_t) are generally assumed to be unsigned, so these should be too. Prompted-by: https://github.com/systemd/systemd/pull/17345#issuecomment-709402332
Diffstat (limited to 'src/basic/time-util.h')
-rw-r--r--src/basic/time-util.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
index cecd5efa60..6feda5e155 100644
--- a/src/basic/time-util.h
+++ b/src/basic/time-util.h
@@ -63,10 +63,10 @@ typedef enum TimestampStyle {
/* We assume a maximum timezone length of 6. TZNAME_MAX is not defined on Linux, but glibc internally initializes this
* to 6. Let's rely on that. */
-#define FORMAT_TIMESTAMP_MAX (3+1+10+1+8+1+6+1+6+1)
-#define FORMAT_TIMESTAMP_WIDTH 28 /* when outputting, assume this width */
-#define FORMAT_TIMESTAMP_RELATIVE_MAX 256
-#define FORMAT_TIMESPAN_MAX 64
+#define FORMAT_TIMESTAMP_MAX (3U+1U+10U+1U+8U+1U+6U+1U+6U+1U)
+#define FORMAT_TIMESTAMP_WIDTH 28U /* when outputting, assume this width */
+#define FORMAT_TIMESTAMP_RELATIVE_MAX 256U
+#define FORMAT_TIMESPAN_MAX 64U
#define TIME_T_MAX (time_t)((UINTMAX_C(1) << ((sizeof(time_t) << 3) - 1)) - 1)