From 3a4a310df39a0632b50bdb12ade4cc06b979335c Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Wed, 12 Feb 2025 09:34:48 -0800 Subject: [PATCH] [libc] Fix implict cast to time_t warning On some systems time_t is 32 bit, causing build errors (with -Werror) in get_epoch which attempts to implicitly convert an int64_t to a time_t. --- libc/src/time/time_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h index 324e129f6f780..68eaac8c04f11 100644 --- a/libc/src/time/time_utils.h +++ b/libc/src/time/time_utils.h @@ -328,7 +328,9 @@ class TMReader final { return BASE_YEAR + IS_NEXT_YEAR; } - LIBC_INLINE time_t get_epoch() const { return mktime_internal(timeptr); } + LIBC_INLINE time_t get_epoch() const { + return static_cast(mktime_internal(timeptr)); + } // returns the timezone offset in microwave time: // return (hours * 100) + minutes;