[rrd-developers] Re: Printing of time component

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sat Aug 11 01:32:57 MEST 2001


Mark Mills 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.
> 
> Actually I think they would need four, wouldn't they? 

Um, yes, two of them will be parsed by either printf or by strftime,
it will be translated into one, the next two will also be translated
into one and you end up with two percent characters in a row.  Correct.

> It should probably ignore terminal % and % followed by whitespace
> without collapsing it to an error. That might save you if you go
> this route but I'm not sure how flexible strftime is on that.

My strftime just ignores the percent character in both cases.
I don't now if this is standard behaviour.

> Alternately, you could write a cheesy expander that would fix the
> bad case before sending it off to either printf or strftime. Of
> course we are still ignoring possible issues like people having
> a character after the "%%" getting date-time values, too.

Yup.  This would be avoided if I made an intelligent parser that
breaks down the string in pieces which will be fed to either printf
or strftime, depending on the characters.  Much more programming (and
thus much more room for bugs) but in the end probably more flexible.

thanks for the input.  Next please.
-- 
   __________________________________________________________________
 / 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