[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
Sun Mar 23 08:21:10 PDT 2025
================
@@ -15,13 +15,18 @@
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(time_t, mktime, (struct tm * tm_out)) {
- int64_t seconds = time_utils::mktime_internal(tm_out);
-
+ auto mktime_result = time_utils::mktime_internal(tm_out);
+ time_t seconds;
+ if (mktime_result.has_value()) {
+ return time_utils::out_of_range();
+ } else {
+ seconds = mktime_result.value();
+ }
----------------
jhuber6 wrote:
```suggestion
time_t seconds;
if (mktime_result) {
return time_utils::out_of_range();
time_t seconds = *mktime_result;
```
https://github.com/llvm/llvm-project/pull/132231
More information about the libc-commits
mailing list