On 15/04/2019 21:55, Assaf Gordon wrote:
To see if this is glibc issue, or perhaps an gnulib/mktime_z wrapper
issue, can you (and/or others) try the attached C program?
It calls time(2)+localtime(3)+mktime(3) to emulate the date adjustment.
Because the adjustment is to year 9 (about 1961 years before epoch),
the time_t value is negative. perhaps that's the issue? or perhaps
combined with a specific timezone it becomes problematic?
For me it gives:
$ ./inv-year
time() = 1555369320
localtime() = 2019-04-16 00:02:00
(mday=16 wday=2, isdst=1)
struct tm (after adjustment) = 0009-04-16 00:02:00
(mday=16 wday=2, isdst=1)
inv-year: mktime() failed: Value too large for defined data type
And debug gives:
$ date +%-Y -d "- 112 years" --debug
date: parsed relative part: -112 year(s)
date: input timezone: system default
date: using current time as starting value: '00:04:32'
date: using current date as starting value: '(Y-M-D) 2019-04-16'
date: starting date/time: '(Y-M-D) 2019-04-16 00:04:32'
date: warning: when adding relative months/years, it is recommended to
specify the 15th of the months
date: error: adding relative date resulted in an invalid date: '(Y-M-D)
1907-04-16 00:04:32'
date: invalid date ‘- 112 years’