[rrd-users] Problems using a bare timespec with -s and -e

Pedro LaWrench pedrolawrench at yahoo.com
Fri Mar 2 19:13:15 CET 2007


--- Pedro LaWrench <pedrolawrench at yahoo.com> wrote:

> --- Alex van den Bogaerdt <alex at ergens.op.het.net> wrote:
> 
> > On Fri, Mar 02, 2007 at 07:12:55AM -0800, Pedro
> > LaWrench wrote:
> > > 
> > > 
> > > Alex van den Bogaerdt <alex at ergens.op.het.net>
> > wrote:  On Thu, Mar 01, 2007 at 04:02:32PM -0800,
> > Pedro LaWrench wrote:
> > > 
> > > >   rrdtool graph /tmp/kc.png -i -s '01:15' -e
> > '09:15' ...
> > > >   now returns
> > > >   ERROR: start time: the specified time is
> > incorrect (out of range?)
> > > 
> > > > Not sure if this is it, but have you tried
> > '01\:15' ?
> > > > I cannot comment on the other question you asked
> > (intended behaviour or not).
> > 
> > > I  tried that, and that didn't work either.  I did
> > try '01:15 3/2/07'
> > >  and this does work.  So it appears that the date
> > must be specified
> > > as well as the time of day.  Previous versions
> > assumed the date  was
> > > today if it was omitted.  This means any script
> > calling  rrdtool must
> > > construct today's date and include it in the 
> > arguments.  Not real
> > > difficult, but an extra step nonetheless.
> > 
> > Try "today".
> > 
> > I don't know about every change.  What I do know is
> > that's it's very
> > difficult to parse time and date in every possible
> > combination.  Order
> > is important ("today 12:00" vs. "12:00 today") and
> > some numbers could
> > be interpreted in more than one way.
> > 
> > If you can create an algorithm that works in every
> > case, let us (the
> > list) know and I'm sure somebody will code it.
> 
> I agree parsing time and date is difficult, but my point is that what used to
> work no longer does.  I have created a table of various formats and the
> behavior in two different versions:
> 
> Spec         1.2.15                          1.2.19
> -----------  ----------------------------    -------------------------------
> today        unparsable time: today          unparsable time: today
> 09:15 today  Works                           the specified time is incorrect
> today 09:15  unparsable time: today 09:15    unparsable time: today 09:15
> 09:15        works                           the specified time is incorrect
> 
> The supposed algorithm is already documented in parsetime.c, but the behavior
> doesn't seem to match:
> 
>  * TIME-SPECIFICATION ::= TIME-REFERENCE [ OFFSET-SPEC ] |
>  *                                         OFFSET-SPEC   |
>  *                         ( START | END ) OFFSET-SPEC
>  *
>  * TIME-REFERENCE ::= NOW | TIME-OF-DAY-SPEC [ DAY-SPEC-1 ] |
>  *                        [ TIME-OF-DAY-SPEC ] DAY-SPEC-2
>  *
>  * TIME-OF-DAY-SPEC ::= NUMBER (':') NUMBER [am|pm] | # HH:MM
>  *                     'noon' | 'midnight' | 'teatime'
>  *
>  * DAY-SPEC-1 ::= NUMBER '/' NUMBER '/' NUMBER |  # MM/DD/[YY]YY
>  *                NUMBER '.' NUMBER '.' NUMBER |  # DD.MM.[YY]YY
>  *                NUMBER                          # Seconds since 1970
>  *                NUMBER                          # YYYYMMDD
>  *
>  * DAY-SPEC-2 ::= MONTH-NAME NUMBER [NUMBER] |    # Month DD [YY]YY
>  *                'yesterday' | 'today' | 'tomorrow' |
>  *                DAY-OF-WEEK
>  *
>  *
>  * OFFSET-SPEC ::= '+'|'-' NUMBER TIME-UNIT { ['+'|'-'] NUMBER TIME-UNIT }
>  *
>  * TIME-UNIT ::= SECONDS | MINUTES | HOURS |
>  *               DAYS | WEEKS | MONTHS | YEARS
>  *
>  * NOW ::= 'now' | 'n'
>  *
>  * START ::= 'start' | 's'
>  * END   ::= 'end' | 'e'
>  *
>  * SECONDS ::= 'seconds' | 'second' | 'sec' | 's'
>  * MINUTES ::= 'minutes' | 'minute' | 'min' | 'm'
>  * HOURS   ::= 'hours' | 'hour' | 'hr' | 'h'
>  * DAYS    ::= 'days' | 'day' | 'd'
>  * WEEKS   ::= 'weeks' | 'week' | 'wk' | 'w'
>  * MONTHS  ::= 'months' | 'month' | 'mon' | 'm'
>  * YEARS   ::= 'years' | 'year' | 'yr' | 'y'
>  *
>  * MONTH-NAME ::= 'jan' | 'january' | 'feb' | 'february' | 'mar' | 'march' |
>  *                'apr' | 'april' | 'may' | 'jun' | 'june' | 'jul' | 'july' |
>  *                'aug' | 'august' | 'sep' | 'september' | 'oct' | 'october'
> |
>  *                'nov' | 'november' | 'dec' | 'december'
>  *
>  * DAY-OF-WEEK ::= 'sunday' | 'sun' | 'monday' | 'mon' | 'tuesday' | 'tue' |
>  *                 'wednesday' | 'wed' | 'thursday' | 'thu' | 'friday' |
> 'fri'
> |
>  *                 'saturday' | 'sat'
> 
> 
> I believe that '09:15' is a valid TIME-OF-DAY-SPEC, and in turn a valid
> TIME-REFERENCE, and ultimately a valid TIME-SPECIFICATION.
> 
> The release notes show a couple of changes to parsetime.c.  I believe one of
> these changes has introduced the problems I am seeing:
> 
> 2006-10-22 21:20  oetiker
> 
>         * src/parsetime.c: make time paring more robust ... it can now deal
>           with time date date time time date + xxx date time + xxx
> 
> 2006-09-27 21:45  oetiker
> 
>         * src/parsetime.c: tod can come after the date as well as before the
>           date
> 
> My apologies for any word wrap that may make this hard to read.
> 
> -PL

I believe this may have been fixed in the latest development snapshot!  I have
found this change in parsetime.c:

*** 850,856 ****
              if ( ptv->tm.tm_hour == 30 ){
                ptv->tm.tm_hour = hour_sv;
                }
!             if ( ptv->tm.tm_hour == 30000 ){
                ptv->tm.tm_year = year_sv;
                }
            };
--- 850,856 ----
              if ( ptv->tm.tm_hour == 30 ){
                ptv->tm.tm_hour = hour_sv;
                }
!             if ( ptv->tm.tm_year == 30000 ){
                ptv->tm.tm_year = year_sv;
                }
            };

Preliminary tests show that formats that used to work are now working again.

-PL


 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news



More information about the rrd-users mailing list