From 4a31fd8c749229be352d2045d4aecd3a125bbad7 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Ond=C5=99ej=20Va=C5=A1=C3=ADk?= Date: Mon, 30 Jun 2008 17:32:28 +0200 Subject: [PATCH] *lib/getdate.y: Allow usage of relative signed time offset even before time zone is specified. Signed-off-by: Ondřej Vašík --- lib/getdate.y | 56 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 45 insertions(+), 11 deletions(-) diff --git a/lib/getdate.y b/lib/getdate.y index 93e8e6f..ff7850c 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -1,8 +1,8 @@ %{ /* Parse a string into an internal time stamp. - Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 Free Software - Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -278,8 +278,8 @@ extract_hhmmss (parser_control *pc, long int ho, long int mi, time_t sec, long i %parse-param { parser_control *pc } %lex-param { parser_control *pc } -/* This grammar has 20 shift/reduce conflicts. */ -%expect 20 +/* This grammar has 32 shift/reduce conflicts. */ +%expect 32 %union { @@ -371,7 +371,43 @@ time: pc->zones_seen++; pc->time_zone = time_zone_hhmm (pc, $6, $7); } - ; + | tUNUMBER ':' tUNUMBER relunit_snumber + { + extract_hhmmss (pc, $1.value, $3.value, 0, 0); + pc->meridian = MER24; + extract_relative_time (pc, $4, 1); + } + | tUNUMBER ':' tUNUMBER ':' unsigned_seconds relunit_snumber + { + extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec); + pc->meridian = MER24; + extract_relative_time (pc, $6, 1); + } + | tUNUMBER ':' tUNUMBER + { + extract_hhmmss (pc, $1.value, $3.value, 0, 0); + pc->meridian = MER24; + } + | tUNUMBER ':' tUNUMBER tSNUMBER + { + extract_hhmmss (pc, $1.value, $3.value, 0, 0); + pc->meridian = MER24; + pc->zones_seen++; + pc->time_zone = time_zone_hhmm (pc, $4, -1); + } + | tUNUMBER ':' tUNUMBER ':' unsigned_seconds + { + extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec); + pc->meridian = MER24; + } + | tUNUMBER ':' tUNUMBER ':' unsigned_seconds tSNUMBER + { + extract_hhmmss (pc, $1.value, $3.value, $5.tv_sec, $5.tv_nsec); + pc->meridian = MER24; + pc->zones_seen++; + pc->time_zone = time_zone_hhmm (pc, $6, -1); + } + ; local_zone: tLOCAL_ZONE @@ -394,6 +430,8 @@ zone: extract_relative_time (pc, $2, 1); } | tZONE tSNUMBER o_colon_minutes { pc->time_zone = $1 + time_zone_hhmm (pc, $2, $3); } + | tZONE tSNUMBER + { pc->time_zone = $1 + time_zone_hhmm (pc, $2, -1); } | tDAYZONE { pc->time_zone = $1 + 60; } | tZONE tDST @@ -594,16 +632,12 @@ hybrid: ; o_colon_minutes: - /* empty */ - { $$ = -1; } - | ':' tUNUMBER + ':' tUNUMBER { $$ = $2.value; } ; o_merid: - /* empty */ - { $$ = MER24; } - | tMERIDIAN + tMERIDIAN { $$ = $1; } ; -- 1.5.2.2