diff options
| author | Yi Wu <43659785+yi-wu-arm@users.noreply.github.com> | 2024-01-11 12:15:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-11 12:15:48 +0000 |
| commit | 959a430a8d5b7e77b3d88327f835d9f9b8a6842e (patch) | |
| tree | bef48493a93ef6d9baa8d4af0fd4f7490d89885a /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
| parent | cc53ec82ea6df6e7602510fa1bf5b8a991b3bc39 (diff) | |
| download | llvm-959a430a8d5b7e77b3d88327f835d9f9b8a6842e.zip llvm-959a430a8d5b7e77b3d88327f835d9f9b8a6842e.tar.gz llvm-959a430a8d5b7e77b3d88327f835d9f9b8a6842e.tar.bz2 | |
[flang] FDATE extension implementation: get date and time in ctime format (#71222)
reference to gfortran fdate
https://gcc.gnu.org/onlinedocs/gfortran/FDATE.html
usage:
```fortran
CHARACTER(32) :: time
CALL fdate(time)
WRITE(*,*) time
```
fdate is used in the ECP proxy application
https://proxyapps.exascaleproject.org/app/minismac2d/
https://github.com/Mantevo/miniSMAC/blob/f90446714226eeef650b78bce06ca4967792e74d/ref/smac2d.f#L1570
`fdate` now produce the same result on flang, compare to gfortran, where
If the length is too short to fit completely, blank return.
```fortran
character(20) :: string
call fdate(string)
write(*, *) string, "X"
```
```bash
$ ../build-release/bin/flang-new test.f90
$ ./a.out
X
```
If length if larger than it requires(24), fill the rest of buffer space.
```fortran
character(30) :: string
call fdate(string)
write(*, *) string, "X"
```
```bash
$ ../build-release/bin/flang-new test.f90
$ ./a.out
Wed Nov 15 16:59:13 2023 X
```
The length value is hardcoded, because:
```c++
// Day Mon dd hh:mm:ss yyyy\n\0 is 26 characters, e.g.
// Tue May 26 21:51:03 2015\n\0
```
---------
Co-authored-by: Yi Wu <yiwu02@wdev-yiwu02.arm.com>
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions
