[rrd-developers] Re: Printing of time component

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Thu Aug 9 22:55:56 MEST 2001


Tobias Oetiker wrote:
> 
> what I would do, is use whatever strftime you get from the system
> how about this. You tell people that they have to use two %% for
> the lf part and one % for the strformat part ... this has the
> effect the first the time gets resolved which also turns %% into %
> and then you run it through printf which resolves the rest ...

This would also work the other way, wouldn't it?  Doing that would
keep existing strings the same, with one exception: Currently many
people will do something like "PRINT:perc:AVERAGE:"%6.2lf %%" and
this will then fail (in both cases, your suggestion and mine).
>From that moment on people will have to use three percent characters
to print one.

> eg
> 
> "%%6.2lf %Y-%m-%d"

"%%6.2lf %%SBps %H:%M:%S"   (first strftime, then printf)
or
"%6.2lf %SBps %%H:%%M:%%S"  (first printf, then strftime)
or
"%6.2lf %SBps %H:%M:%S"     (smart parser, reads mind)

> writing your own implementation of strftime looks a bit like
> overkill ...

Indeed, I didn't like the idea myself.
If I'm not going to implement the double percent character thingy,
I have to make a special case for %s anyway.  I could easely fill
in the time-since-epoch myself and hand over the rest to strftime.

Oh well, lets wait a while and see what others think of it.
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
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