[flang-commits] [flang] [Flang] `TIME_UTC` is not available on AIX7.2. Using POSIX alternative `clock_gettime` instead. (PR #98915)

via flang-commits flang-commits at lists.llvm.org
Mon Jul 15 08:13:50 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Daniel Chen (DanielCChen)

<details>
<summary>Changes</summary>

This PR is to fix a build breakage on AIX7.2 due to `TIME_UTC` is not available.

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


1 Files Affected:

- (modified) flang/runtime/time-intrinsic.cpp (+4) 


``````````diff
diff --git a/flang/runtime/time-intrinsic.cpp b/flang/runtime/time-intrinsic.cpp
index 7352dafc9136e..401be4ebf4764 100644
--- a/flang/runtime/time-intrinsic.cpp
+++ b/flang/runtime/time-intrinsic.cpp
@@ -144,7 +144,11 @@ template <typename Unused = void>
 count_t GetSystemClockCount(int kind, fallback_implementation) {
   struct timespec tspec;
 
+#ifdef _AIX
+  if (clock_gettime(CLOCK_REALTIME, &tspec) < 0) {
+#else
   if (timespec_get(&tspec, TIME_UTC) < 0) {
+#endif
     // Return -HUGE(COUNT) to represent failure.
     return -static_cast<count_t>(GetHUGE(kind));
   }

``````````

</details>


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


More information about the flang-commits mailing list