[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
Thu Mar 20 08:33:00 PDT 2025


================
@@ -18,29 +18,41 @@ namespace LIBC_NAMESPACE_DECL {
 namespace time_utils {
 
 // TODO: clean this up in a followup patch
-int64_t mktime_internal(const tm *tm_out) {
+time_t mktime_internal(const tm *tm_out, bool* out_of_range_flag) {
----------------
jhuber6 wrote:

I'd prefer returning a struct personally. It's a shame we don't have a generic tuple type in the C++ support headers. C++17 has RVO guaranteed so it's not like it's a performance thing and doing something like this feels cleaner to me.
```c++
return {time_constants::OUT_OF_RANGE_RETURN_VALUE, true}.

auto [seconds, out_of_range] = mktime_internal(tm_out);
```

https://github.com/llvm/llvm-project/pull/132231


More information about the libc-commits mailing list