[rrd-users] inconsistency in src/parsetime.c rrdtool 1.0.49

Haroon Rafique haroon.rafique at utoronto.ca
Fri Oct 1 16:49:46 MEST 2004


Hi,

I noticed an inconsistency in the documentation in src/parsetime.c. I 
looked in the contrib directory and there is a trytime directory which 
helped me isolate the anomaly a little further.

According to the at style time specification notes (from man rrdfetch), 
-6m should be interpreted as -6 months. However, that's not the case 
currently. It is interpreted as -6 minutes.

Try:

./contrib/trytime/trytime -s -6m -e -5m
The time now is: Fri Oct  1 10:35:12 2004

Start time was specified as: '-6m',
for me this means: Fri Oct  1 10:29:12 2004 EDT (or 1096640952 sec since 
epoch)

End time was specified as: '-5m',
for me this means: Sat May  1 10:35:12 2004 EDT (or 1083422112 sec since 
epoch)

Notice how the -6m got interpreted as -6 minutes. This is in direct 
contrast with the following comment in src/parsetime.c

  * As you may note, there is an ambiguity with respect to
  * the 'm' time unit (which can mean either minutes or months).
  * To cope with this, code tries to read users mind :) by applying
  * certain heuristics. There are two of them:
  *
  * 1. If 'm' is used in context of (i.e. right after the) years,
  *    months, weeks, or days it is assumed to mean months, while
  *    in the context of hours, minutes, and seconds it means minutes.
  *    (e.g., in -1y6m or +3w1m 'm' means 'months', while in
  *    -3h20m or +5s2m 'm' means 'minutes')
  *
  * 2. Out of context (i.e. right after the '+' or '-' sign) the
  *    meaning of 'm' is guessed from the number it directly follows.
  *    Currently, if the number absolute value is below 25 it is assumed
  *    that 'm' means months, otherwise it is treated as minutes.
  *    (e.g., -25m == -25 minutes, while +24m == +24 months)
  *

line 511 seems to be the culprit:

     511              if( delta < 6 ) /* it may be some other value but in the context
     512                    * of RRD who needs less than 6 min deltas? */
     513                sc_tokid = MONTHS;
     514              else
     515            sc_tokid = MINUTES;


Anyone care to comment? Its not really a bug, but I think the 
documentation should be fixed in:

./contrib/trytime/README
./src/parsetime.c
./doc/rrdfetch.pod

to make it clear that:
  *    Currently, if the number absolute value is below 6 it is assumed
  *    that 'm' means months, otherwise it is treated as minutes.
  *    (e.g., -6m == -6 minutes, while +5m == +5 months)

I did join rrd-developers but the welcome message said rrd-developers was 
only for discussing the future of rrd.

Thanks in advance,
--
Haroon Rafique
<haroon.rafique at utoronto.ca>

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list