[rrd-developers] Re: If I could save time as a double ...

Tobias Oetiker oetiker at ee.ethz.ch
Fri Nov 23 23:31:51 MET 2001


Monday Mark Mills wrote:


> > > 1) Modify rrdtool to allow a double as the step value.
> >
> > I'd opt for an integer fraction.  A short brainstorm session with
> > myself alone showed that IMHO it is much cleaner.  Another 32-bit
> > value gives the most digits per byte *and* gives the best precision
> > so that's probably what would be best.  Using an integer in stead of
> > a double will probably cause less rounding errors, at least that's
> > my gut feeling.

> Would it be easier to patch it to treat the step as milli-seconds? or
> hundredths?

well this looks rather hackerish to me ... I would prefer to see

typedef struct stat_head_t {

    /* Data Base Identification Section ***/
    char             cookie[4];          /* RRD */
    char             version[5];         /* version of the format */
    double           float_cookie;       /* is it the correct double
                                          * representation ?  */

    /* Data Base Structure Definition *****/
    unsigned long    ds_cnt;             /* how many different ds provide
                                          * input to the rrd */
    unsigned long    rra_cnt;            /* how many rras will be maintained
                                          * in the rrd */
    unsigned long    pdp_step;           /* pdp interval in seconds */

    unival           par[10];            /* global parameters ... unused
                                            at the moment */
} stat_head_t;


modified to

                                          * in the rrd */
    unsigned long    pdp_step;           /* pdp interval in seconds */
    unsigned long    pdp_step_usec;      /* part of the step in micro seconds */
    unival           par[9];            /* global parameters ... unused
                                            at the moment */

this should make the compatibility with quite easy to achieve ...

a few defined accessor functions will take care of the rest ...

cheers
tobi

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, ETZ J97, ETH, 8092 Zurich, Switzerland
 / // _ \/ _ \/ / phoneto:+41(0)1-632-5286  faxto:+41(0)1-632-1517
/_/ \.__/_.__/_/ mailto:oetiker at ee.ethz.ch http://people.ee.ethz.ch/~oetiker


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