[flang-commits] [flang] [llvm] [flang][flang-rt] Add support for non-standard TIMEF intrinsic (PR #185377)

via flang-commits flang-commits at lists.llvm.org
Mon Mar 9 06:22:44 PDT 2026


================
@@ -413,6 +413,18 @@ double RTNAME(Dsecnds)(double *refTime, const char *sourceFile, int line) {
 // GNU extension function TIME()
 std::int64_t RTNAME(time)() { return time(nullptr); }
 
+// Intel extension function TIMEF()
+// Returns number of seconds that have elapsed since the first time
+// TIMEF was called. For the first call, it returns 0.
+double RTNAME(Timef)() {
+  static double first = -1;
----------------
NimishMishra wrote:

Thanks for pointing this out @jeanPerier. I did not find any information in multi-threaded contexts, but I suppose we would like TIMEF functionality to remain intact even in those contexts.

Do you think a specifier like `thread_local` can help? Source: [link](https://en.cppreference.com/w/cpp/language/storage_duration.html)

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


More information about the flang-commits mailing list