[rrd-developers] Re: 18:00 yesterday - is this timespec OK?
Pavel Mores
pvl at uh.cz
Thu Jan 31 11:28:31 MET 2002
On Wed, Jan 23, 2002 at 11:43:54PM +0100, Tobias Oetiker wrote:
> Today Pavel Mores wrote:
> >
> > I'm building a custom monitoring system based on the wonderful rrdtool.
> > However, I've been unable to figure out how to use the "yesterday"
> > day specification. I think that "18:00 yesterday" should be valid
> > according to the syntax described in parsedate.c . "18:00" looks like a
> > valid TIME-OF-DAY-SPEC, "yesterday" is included in DAY-SPEC-2 list of
> > options and together they form a valid TIME-REFERENCE.
> >
> > Still, the parser refuses it ("ERROR: start time: unparsable trailing
> > text: '...yesterday'"). Looking at parsetime() it seems to me that
> > there's a bug in the "case NUMBER:" block. tod() parses the "18:00" part
> > and prefetches the "yesterday" token. However, if the prefetched token
> > is not NUMBER (which it is not here) parsing essentially ends here (from
> > now on the parser looks for offset spec only) so no wonder that
> > "yesterday" comes out as "unparsable trailing text".
> >
> > Is this just my stupidity or is it really a bug?
>
> the parsetime code is badly broken. A working and correct version
> or also patches for the bugs are greatly appreciated ... I have
> never been bothered enough to fix it myself ... (shame on me)
Tobi,
thanks for your explanation. Here's a tiny patch that fixes the bugs I
mentioned in my previous message and some more. Unfortunatelly, that's
all I can do, at least for now. :(
Oh - and thanks for your wonderful software! :)
pvl
--- parsetime.c.orig Thu Jan 31 11:20:24 2002
+++ parsetime.c Thu Jan 24 14:13:08 2002
@@ -697,6 +697,7 @@
*/
wday = (sc_tokid-SUN);
ptv->tm.tm_mday += (wday - ptv->tm.tm_wday);
+ token();
break;
/*
mday = ptv->tm.tm_mday;
@@ -835,7 +836,9 @@
/* Only absolute time specifications below */
case NUMBER:
try(tod(ptv))
- if (sc_tokid != NUMBER) break;
+ try(day(ptv))
+ break;
+ //if (sc_tokid != NUMBER) break;
/* fix month parsing */
case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list