From 4c9db16207b5c76bb85b05ee5853c525372bb80a Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Fri, 27 Jun 2008 16:32:28 +0200 Subject: [PATCH] *lib/getdate.y: Do not ignore specified time zone when relative offset for days/months/years is specified. Signed-off-by: Ondřej Vašík --- lib/getdate.y | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index 1deec51..7b55c31 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1436,26 +1436,7 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) goto fail; } - if (pc.zones_seen) - { - long int delta = pc.time_zone * 60; - time_t t1; -#ifdef HAVE_TM_GMTOFF - delta -= tm.tm_gmtoff; -#else - time_t t = Start; - struct tm const *gmt = gmtime (&t); - if (! gmt) - goto fail; - delta -= tm_diff (&tm, gmt); -#endif - t1 = Start - delta; - if ((Start < t1) != (delta < 0)) - goto fail; /* time_t overflow */ - Start = t1; - } - - /* Add relative date. */ + /* Add relative date. */ if (pc.rel.year | pc.rel.month | pc.rel.day) { int year = tm.tm_year + pc.rel.year; @@ -1477,6 +1458,25 @@ get_date (struct timespec *result, char const *p, struct timespec const *now) goto fail; } + if (pc.zones_seen) + { + long int delta = pc.time_zone * 60; + time_t t1; +#ifdef HAVE_TM_GMTOFF + delta -= tm.tm_gmtoff; +#else + time_t t = Start; + struct tm const *gmt = gmtime (&t); + if (! gmt) + goto fail; + delta -= tm_diff (&tm, gmt); +#endif + t1 = Start - delta; + if ((Start < t1) != (delta < 0)) + goto fail; /* time_t overflow */ + Start = t1; + } + /* Add relative hours, minutes, and seconds. On hosts that support leap seconds, ignore the possibility of leap seconds; e.g., "+ 10 minutes" adds 600 seconds, even if one of them is a -- 1.5.2.2