[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>
Loading
Please sign in to comment