bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

parse-datetime: invalid date range shifted by 30 minutes for Singapore T


From: Kamil Dudka
Subject: parse-datetime: invalid date range shifted by 30 minutes for Singapore TZ
Date: Mon, 12 Aug 2019 17:02:49 +0200

In 1981, there was a change in TZ for Singapore and Malaysia which went from 
UTC+7.5 to UTC+8.  It happened at 1981-12-31 23:30:00 which became 1982-01-01 
00:00:00.

As I understand it, the range 1981-12-31 23:30:00 .. 1981-12-31 23:59:59 
should be invalid, whereas the range 1982-01-01 00:00:00 .. 1982-01-01 
00:29:59 should be valid.  GNU date sees it exactly opposite.

I do not fully understand the code of gnulib's parse-datetime.y -- mktime_z() 
converts 1982-01-01 00:00:00 to 1981-12-31 23:30:00 and the subsequent call
of mktime_ok() returns false, causing the failure.

Minimal example:

$ TZ=Asia/Singapore date --debug -d 1982-01-01
date: parsed date part: (Y-M-D) 1982-01-01
date: input timezone: TZ="Asia/Singapore" environment value
date: warning: using midnight as starting time: 00:00:00
date: error: invalid date/time value:
date:     user provided time: '(Y-M-D) 1982-01-01 00:00:00'
date:        normalized time: '(Y-M-D) 1981-12-31 23:30:00'
date:                                  ---- -- -- -- --
date:      possible reasons:
date:        invalid day/month combination;
date:        numeric values overflow;
date:        missing timezone
date: invalid date ‘1982-01-01’

Original reported at https://bugzilla.redhat.com/1739747 .

Kamil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]