Skip to content

Commit 3a4a310

Browse files
[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.
1 parent 574ccc6 commit 3a4a310

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libc/src/time/time_utils.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@ class TMReader final {
328328
return BASE_YEAR + IS_NEXT_YEAR;
329329
}
330330

331-
LIBC_INLINE time_t get_epoch() const { return mktime_internal(timeptr); }
331+
LIBC_INLINE time_t get_epoch() const {
332+
return static_cast<time_t>(mktime_internal(timeptr));
333+
}
332334

333335
// returns the timezone offset in microwave time:
334336
// return (hours * 100) + minutes;

0 commit comments

Comments
 (0)