[rrd-developers] Re: Patch to rrd_graph.c for printing only epoch time of a VDEF

Stefan Moser sm at open.ch
Thu May 19 16:36:01 MEST 2005


Alex van den Bogaerdt wrote:
> On Thu, May 19, 2005 at 12:54:23PM +0200, Stefan Moser wrote:
> 
> 
>>I've written a small patch for rrd_graph.c to be able to print the epoch time
>>value instead of the ctime(3) formatted date string as is the default. I've
>>chosen %t for the formatter string (strftime uses %s, but this might lead to
>>confusion with the %s used for magnitude).
> 
> 
> I don't think this is the way to go.  If we start using our own
> characters, eventually we find ourselves in a situation where the
> rest of the world will have started using the same characters but
> with a different meaning.  Talk about confusion.
> 
> What about having either a new command (PRINTT or TPRINT) or having
> a new escape sequence ('%_t' or '~t') ?

Oh yes, I totally agree! The mixing of sprintf and strftime formatters irked me
as well, but a patch to address *that* would have been really intrusive.
Personally, I'd prefer a different prefix over a different command as it would
allow to mix value and time in the same statement (e.g. '%lf@~s', resulting in
90941.089605 at 1116483600). Now that I've studied the relevant code I know why it
is so, but when I first noticed that either time or value (but not both) can be
printed in the same statement, it struck me as kind of artificial.

> 
> 
>>  # rrdtool graph foo.png DEF:foo=foo.rrd:outOctets:AVERAGE \
>>     VDEF:vfoo=foo,MAXIMUM PRINT:vfoo:'%lf'
>>  0x0
>>  90941.089605
> 
> 
>>  # rrdtool graph foo.png DEF:foo=foo.rrd:outOctets:AVERAGE \
>>     VDEF:vfoo=foo,MAXIMUM PRINT:vfoo:'%lf'
>>  0x0
>>  1116483600
> 
> 
> That would be "PRINT:vfoo:'%t'", right ?

I believe it's called cut&paste idiocy :)

--
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://lists.ee.ethz.ch/rrd-developers
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-developers mailing list