Skip to content

Commit 9fb7924

Browse files
authored
[libc][time] Fix -Wshorten-64-to-32 warning (#132947)
This breaks builds of libc with top of tree clang under -Werror.
1 parent 1bb755f commit 9fb7924

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libc/src/time/time_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ cpp::optional<time_t> mktime_internal(const tm *tm_out) {
102102

103103
// TODO: https://github.com/llvm/llvm-project/issues/121962
104104
// Need to handle timezone and update of tm_isdst.
105-
time_t seconds = tm_out->tm_sec +
106-
tm_out->tm_min * time_constants::SECONDS_PER_MIN +
107-
tm_out->tm_hour * time_constants::SECONDS_PER_HOUR +
108-
total_days * time_constants::SECONDS_PER_DAY;
105+
time_t seconds = static_cast<time_t>(
106+
tm_out->tm_sec + tm_out->tm_min * time_constants::SECONDS_PER_MIN +
107+
tm_out->tm_hour * time_constants::SECONDS_PER_HOUR +
108+
total_days * time_constants::SECONDS_PER_DAY);
109109
return seconds;
110110
}
111111

0 commit comments

Comments
 (0)