Ondřej Vašík <[EMAIL PROTECTED]> wrote: > Hello, > as discussed with Jim Meyering via IRC, I'm sending changed version of > the patch #3 to the list. This one patch adds range to valid TZ and > handles correctly hours when no minutes are specified (until that patch > is UTC+14 handled incorrectly as UTC+0:14) and are in common range of > UTC-12 to UTC+14. > Although there are few different implementations of TZ limits (Microsoft > uses range UTC-14 to UTC+14 , various sources show that only TZ between > UTC-12 and UTC+14 are in use), this patch uses range UTC-24 to UTC+24 as > recommended for TZ environmental variable in POSIX > (http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap08.html). > After applying that patch invalid TZ will show an invalid date format > error (because of double increment of pc->zones_seen). > I added few tests to gnulib getdate test suite to check if various TZ > formats are showing the same result. > > Greetings, > Ondrej Vasik > > > From 1c284d1a4155136ddaee44eab7fd5d55a75962fc Mon Sep 17 00:00:00 2001 > From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= <[EMAIL PROTECTED]> > Date: Fri, 4 Jul 2008 17:44:57 +0200 > Subject: [PATCH] getdate.y: add limits for TZ, handle TZ +HH format correctly > > * lib/getdate.y (time_zone_hh_mm): Allow only TZ in the range > UTC-24 to UTC+24 hours, consider first two digits of TZ as hours > when no minutes are specified and number is in the range -14 > and +14 (as common TZ ranges UTC-12 to UTC+14). Invalid TZ will > cause invalid date format error. > * tests/test-getdate.c: Tests for that change > --- > ChangeLog | 9 ++++++++ > lib/getdate.y | 35 ++++++++++++++++++++++++++------- > tests/test-getdate.c | 51 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 87 insertions(+), 8 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 6c5f522..076d70e 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,12 @@ > +2008-07-04 Ondřej Vašík <[EMAIL PROTECTED]> > + > + getdate.y: Allow only timezone range specified by POSIX > + * lib/getdate.y (time_zone_hhmm): Allow only TZ in the range > + -24 to +24 hours, consider first two digits between -14 and 14 > + as hours (as common TZ ranges UTC-12 to UTC+14). Invalid TZ > + will cause invalid format error. > + * tests/test-getdate.c: Tests for the fix
Hi Ondřej, I'm a little leery of this patch, because it makes interpretation of UTC+dd and UTC-dd dependent on the value of dd. For dd <= 14, dd represents hours. Otherwise, it represents minutes. That would have to be documented, but seems odd enough that my reflex is to avoid the change so I don't have to document something so strange. However, Paul Eggert is the official maintainer of this package, so let's see what he thinks. Paul, for more context, here's the original thread: http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/13986/focus=14012