----- Original Message ----- From: "Jean-Edouard Babin" <[email protected]> To: <[email protected]> Sent: Wednesday, May 19, 2010 12:08 AM Subject: [rrd-developers] Discuss regarding Ticket 263
> 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) It seems to me your problem is different. It is the actual printing which should not happen or be altered, you would benefit more from a conditional (G)PRINT. VDEF itself is fine, your program flow tries to do something RRDtool currently is not able to. > 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). Using 0 was a design choice. > 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. I don't think time 0 will ever be valid, so instead of adding something to this struct, why not simply if (vdef->when==0) printf("none"); else {...whatever is done now...} ? Instead of "none", it could be "-" repeated, so that if the user requests a certain field width it complies with that. Or, given what I write in the first line of my response, have a test for 0 and somehow be able to if time==0 GPRINT:... some comment else GPRINT:... the current parameters That last is more work but could also be used in more cases. Just my 2ct _______________________________________________ rrd-developers mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
