X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_rrdcreate.c;h=091b5fa6dce1d2cc3bc48bb093298f39e5d0af46;hb=77311aed583ac4566d76f1ce3a1dc9deae2e59dc;hp=7a389f26922d0f11e5c0ac8af4d07ae41f09d277;hpb=83077c18c3e78739c2d2d18debf99875944eaa72;p=collectd.git diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index 7a389f26..091b5fa6 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -156,7 +156,7 @@ static int rra_get (char ***ret, const value_list_t *vl, /* {{{ */ if (rra_num >= rra_max) break; - status = ssnprintf (buffer, sizeof (buffer), "RRA:%s:%3.1f:%u:%u", + status = ssnprintf (buffer, sizeof (buffer), "RRA:%s:%.10f:%u:%u", rra_types[j], cfg->xff, cdp_len, cdp_num); if ((status < 0) || ((size_t) status >= sizeof (buffer))) @@ -374,7 +374,7 @@ int cu_rrd_create_file (const char *filename, /* {{{ */ int ds_num; int status = 0; time_t last_up; - int stepsize; + unsigned long stepsize; if (check_create_dir (filename)) return (-1); @@ -405,19 +405,17 @@ int cu_rrd_create_file (const char *filename, /* {{{ */ memcpy (argv + ds_num, rra_def, rra_num * sizeof (char *)); argv[ds_num + rra_num] = NULL; - if (vl->time == 0) - last_up = time (NULL) - 10; - else - last_up = CDTIME_T_TO_TIME_T (vl->time) - 10; + last_up = CDTIME_T_TO_TIME_T (vl->time); + if (last_up <= 0) + last_up = time (NULL); + last_up -= 1; if (cfg->stepsize > 0) stepsize = cfg->stepsize; else - stepsize = (int) CDTIME_T_TO_TIME_T (vl->interval); + stepsize = (unsigned long) CDTIME_T_TO_TIME_T (vl->interval); - assert (vl->time > 10); - status = srrd_create (filename, - stepsize, last_up, + status = srrd_create (filename, stepsize, last_up, argc, (const char **) argv); free (argv);