[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
Sat Mar 28 06:23:28 PDT 2026


NimishMishra wrote:

Thanks @klausler and @eugeneepshteyn for the suggestions. The current version of this PR relies on a documented environment behaviour that changes between second/millisecond resolution.

For the following program:
```
program main
  integer i, j
  real(8) elapsed_time
  elapsed_time = timef()
  print *, elapsed_time
  do i = 1, 10000000000
     j = j + 1
  end do
  elapsed_time = timef()
  print *, elapsed_time
end
```

The following are the execution outputs on my machine:

1) `flang timef.90 -o out; ./out`

```
0.
5.33
```

2) `export TIMEF_IN_MILLISECONDS=0; flang timef.90 -o out; ./out`

```
0.
5.32
```

3) `export TIMEF_IN_MILLISECONDS=1; flang timef.90 -o out; ./out`

```
0.
5310.
```

Hope this is okay. I have also added documentation for this environment variable in `flang/docs/intrinsics.md`

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


More information about the flang-commits mailing list