From: oetiker Date: Sun, 22 Oct 2006 21:20:45 +0000 (+0000) Subject: make time paring more robust ... it can now deal with X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=420abbb89cea73b9947ee061f30914fcf16fad42;p=rrdtool.git make time paring more robust ... it can now deal with time date date time time date + xxx date time + xxx git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@908 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/parsetime.c b/src/parsetime.c index f195843..47ddbbf 100644 --- a/src/parsetime.c +++ b/src/parsetime.c @@ -837,9 +837,23 @@ parsetime(const char *tspec, struct rrd_time_value *ptv) /* Only absolute time specifications below */ case NUMBER: - try(tod(ptv)) - try(day(ptv)) - try(tod(ptv)) + { + long hour_sv = ptv->tm.tm_hour; + long year_sv = ptv->tm.tm_year; + ptv->tm.tm_hour = 30; + ptv->tm.tm_year = 30000; + try(tod(ptv)) + try(day(ptv)) + if ( ptv->tm.tm_hour == 30 && ptv->tm.tm_year != 30000 ){ + try(tod(ptv)) + } + if ( ptv->tm.tm_hour == 30 ){ + ptv->tm.tm_hour = hour_sv; + } + if ( ptv->tm.tm_hour == 30000 ){ + ptv->tm.tm_year = year_sv; + } + }; break; /* fix month parsing */ case JAN: case FEB: case MAR: case APR: case MAY: case JUN: