[libc-commits] [libc] change the return value type of mktime_internal to time_t (PR #132231)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Mar 24 08:52:26 PDT 2025
================
@@ -329,7 +329,11 @@ class TMReader final {
}
LIBC_INLINE time_t get_epoch() const {
- return static_cast<time_t>(mktime_internal(timeptr));
+ auto seconds = mktime_internal(timeptr);
+ if (seconds.has_value())
+ return seconds.value();
+
+ return time_utils::out_of_range();
----------------
jhuber6 wrote:
```suggestion
auto seconds = mktime_internal(timeptr);
return seconds ? *seconds : time_utils::out_of_range();
```
https://github.com/llvm/llvm-project/pull/132231
More information about the libc-commits
mailing list