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

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Mar 13 07:16:42 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;
----------------
eugeneepshteyn wrote:

Well, I vote that `timef()` should return milliseconds for the following reasons:

(1) NVIDIA is my employer and nvfortran has `timef()` return time in milliseconds. :-)
(2) XLF is another compiler that `timef()` return time in milliseconds.

Do we know of other compilers that implement `timef()`? If not, it's 2 to 1 in favor of milliseconds.

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


More information about the flang-commits mailing list