[rrd-developers] Re: Printing of time component
mark at xodiax.com
Fri Aug 10 00:21:32 MEST 2001
> > 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?
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.
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.
> 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.
You should probably suggest that people stop using %s and add a new,
unambiguous, flag for the special parser to use as well. That way you
can push people with newer configs away from the weird cases.
Or break it a different way and pick a new char to strftime with.
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
More information about the rrd-developers