[rrd-developers] Discuss regarding Ticket 263

Tobias Oetiker tobi at oetiker.ch
Thu May 20 08:33:21 CEST 2010


Hi Jean-Edouard,

Yesterday Jean-Edouard Babin wrote:

> Hi Tobi,
>
> Here is a patch.
> I added a int instead of a bool as it seems that int is used for
> booleans everywhere in the code.

yep

> I called fct1 time_clean. I tried to catch as much formatter as
> possible but of course as strftime() formatter's are not the same
> depending of OS my code can't handle this very well...

hmmm, I wonder if strftime itself could somehow be queried to help ... the
list of characters you handle there seems awfully long to me ...

> I hope my code is not too much ugly.. I did not practice C for a while.

looks fine by me ...


> Best regards,
>
> On Wed, May 19, 2010 at 12:38 AM, Tobias Oetiker <tobi at oetiker.ch> wrote:
> > Hi Jean-Edouard,
> >
> > the when part of the system simply does not make sense all the time
> > ... eg for AVERAGE ...
> >
> > how about having boolean flag in the structure called 'never' when
> > this is true your fct1 function would be called ...
> >
> > cheers
> > tobi
> >
> >
> > Today Jean-Edouard Babin wrote:
> >
> >> Hello,
> >>
> >> Yesterday I opened a new ticked
> >> http://oss.oetiker.ch/rrdtool-trac/ticket/263 because I got a wrong
> >> output when printing time of an empty VDEF. (time is 1st Jan 1970)
> >> I just find out why, in function vdef_calc of rrd_graph.c, cases
> >> (VDEF_MAXIMUM, VDEF_AVERAGE, VDEF_FIRST, ...) set dst->vf.when to 0 if
> >> value is unknow (which is my case).
> >>
> >> I would be happy to try to do a patch, but I would like to discuss how
> >> to do it before doing something. (I don't want to do something that
> >> will not be commited because it's not a proper solution)
> >>
> >> vdef struct is currently as follow:
> >>
> >> typedef struct vdef_t {
> >>     enum vdef_op_en op;
> >>     double    param;    /* parameter for function, if applicable */
> >>     double    val;      /* resulting value */
> >>     time_t    when;     /* timestamp, if applicable */
> >> } vdef_t;
> >>
> >> My idea would be to add a new 'isnull' boolean variable to the struct,
> >> so that in print_calc I could add some test on isnull be able to run
> >> something else that strftime (let's say fct1()) when isnull is true.
> >> fct1() would replace each %X values by '-'.
> >> So "GPRINT:maxabc2:  Reach 100% @ %c :strftime" would print "Reach
> >> 100% @ -", "GPRINT:maxabc2:  Reach 100% @ %Y/%m/%d :strftime" would
> >> print "Reach 100% @ -/-/-"
> >>
> >> Do you have any comments about this idea ?
> >>
> >> _______________________________________________
> >> rrd-developers mailing list
> >> rrd-developers at lists.oetiker.ch
> >> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
> >>
> >>
> >
> > --
> > Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
> > http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
> >
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900


More information about the rrd-developers mailing list