[libc-commits] [libc] [libc] fix get_epoch constexpr error (PR #126818)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 11 14:53:10 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Michael Jones (michaelrj-google)

<details>
<summary>Changes</summary>

get_epoch calls mktime_internal which isn't constexpr. For now, just
remove the constexpr from get_epoch.


---
Full diff: https://github.com/llvm/llvm-project/pull/126818.diff


1 Files Affected:

- (modified) libc/src/time/time_utils.h (+1-3) 


``````````diff
diff --git a/libc/src/time/time_utils.h b/libc/src/time/time_utils.h
index 30cdcbc170639..324e129f6f780 100644
--- a/libc/src/time/time_utils.h
+++ b/libc/src/time/time_utils.h
@@ -328,9 +328,7 @@ class TMReader final {
     return BASE_YEAR + IS_NEXT_YEAR;
   }
 
-  LIBC_INLINE constexpr time_t get_epoch() const {
-    return mktime_internal(timeptr);
-  }
+  LIBC_INLINE time_t get_epoch() const { return mktime_internal(timeptr); }
 
   // returns the timezone offset in microwave time:
   // return (hours * 100) + minutes;

``````````

</details>


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


More information about the libc-commits mailing list