summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2022-01-14 18:35:44 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2022-01-14 18:35:44 +0100
commit87aafd5d45f064412ff977e4045b7f603ba092c6 (patch)
tree4f36a2c6b87f98347b6c25c115df00d4a4ddba70
parent2101baf3bbdfbd0c042bad438759d810613f31ed (diff)
util: strtotime: expand on comment about 2038-readiness
Also tested on MIPS32BE which has 32-bit time_t and which wraps the time value.
-rw-r--r--util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/util.c b/util.c
index 7feaf7f..d6cdbf9 100644
--- a/util.c
+++ b/util.c
@@ -298,8 +298,9 @@ strtotime(const char *s, time_t *t)
l = strtoll(s, &e, 10);
if (errno || *s == '\0' || *e)
return -1;
- /* NOTE: assumes time_t is 64-bit on 64-bit platforms:
- long long (at least 64-bit) to time_t. */
+
+ /* NOTE: the type long long supports the 64-bit range. If time_t is
+ 64-bit it is "2038-ready", otherwise it is truncated/wrapped. */
if (t)
*t = (time_t)l;