Hi FX,
Am 16.12.21 um 15:17 schrieb FX via Fortran:
Hi,
DATE_AND_TIME can return incorrect values for non-UTC timezones, near the new
year, when the local time and UTC time are in different years.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98507
Attached patch fixes the issue by correcting the logic to account for that
wrapping of “day of the year” around new year. I include a testcase, which
checks the sanity of values returned by DATE_AND_TIME. Since the bug only
occurs for a few hours every year, and depends on local timezone, I could not
think of a better (systematic) test.
please change "call abort" to "stop n". The former should no longer be
used in the testsuite.
I also want to propose (it’s not directly needed to fix the bug) that we switch
our time routines to rely on clock_gettime() instead of gettimeofday(), when
available. This is in line with POSIX.1-2008, which marks gettimeofday() as
obsolete, recommending the use of
clock_gettime() instead.
Agreed.
Bootstrapped and regtested on x86_64-pc-linux-gnu.
OK to commit?
FX
OK after fixing the above, and thanks for the patch!
Harald