diff --git a/flang/runtime/time-intrinsic.cpp b/flang/runtime/time-intrinsic.cpp --- a/flang/runtime/time-intrinsic.cpp +++ b/flang/runtime/time-intrinsic.cpp @@ -62,10 +62,13 @@ #define CLOCKID CLOCK_THREAD_CPUTIME_ID #elif defined CLOCK_MONOTONIC #define CLOCKID CLOCK_MONOTONIC -#else +#elif defined CLOCK_REALTIME #define CLOCKID CLOCK_REALTIME +#else +#undef CLOCKID #endif +#ifdef CLOCKID // POSIX implementation using clock_gettime. This is only enabled where // clock_gettime is available. template @@ -80,6 +83,7 @@ // Return some negative value to represent failure. return -1.0; } +#endif using count_t = std::int64_t; using unsigned_count_t = std::uint64_t; @@ -136,6 +140,7 @@ constexpr unsigned_count_t MS_PER_SEC{1'000u}; constexpr unsigned_count_t NS_PER_SEC{1'000'000'000u}; +#ifdef CLOCKID template count_t GetSystemClockCount(int kind, preferred_implementation, // We need some dummy parameters to pass to decltype(clock_gettime). @@ -156,6 +161,7 @@ return (sec * DS_PER_SEC + (nsec / (NS_PER_SEC / DS_PER_SEC))) % (huge + 1); } } +#endif template count_t GetSystemClockCountRate(int kind, preferred_implementation,