projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Many plugins and files: Convert "interval_g" and "vl->interval" to cdtime_t.
[collectd.git]
/
src
/
utils_rrdcreate.c
diff --git
a/src/utils_rrdcreate.c
b/src/utils_rrdcreate.c
index
4ecec59
..
7a389f2
100644
(file)
--- a/
src/utils_rrdcreate.c
+++ b/
src/utils_rrdcreate.c
@@
-103,7
+103,10
@@
static int rra_get (char ***ret, const value_list_t *vl, /* {{{ */
return (-1);
}
return (-1);
}
- ss = (cfg->stepsize > 0) ? cfg->stepsize : vl->interval;
+ if (cfg->stepsize > 0)
+ ss = cfg->stepsize;
+ else
+ ss = (int) CDTIME_T_TO_TIME_T (vl->interval);
if (ss <= 0)
{
*ret = NULL;
if (ss <= 0)
{
*ret = NULL;
@@
-241,7
+244,9
@@
static int ds_get (char ***ret, /* {{{ */
status = ssnprintf (buffer, sizeof (buffer),
"DS:%s:%s:%i:%s:%s",
d->name, type,
status = ssnprintf (buffer, sizeof (buffer),
"DS:%s:%s:%i:%s:%s",
d->name, type,
- (cfg->heartbeat > 0) ? cfg->heartbeat : (2 * vl->interval),
+ (cfg->heartbeat > 0)
+ ? cfg->heartbeat
+ : (int) CDTIME_T_TO_TIME_T (2 * vl->interval),
min, max);
if ((status < 1) || ((size_t) status >= sizeof (buffer)))
break;
min, max);
if ((status < 1) || ((size_t) status >= sizeof (buffer)))
break;
@@
-323,7
+328,7
@@
static int srrd_create (const char *filename, /* {{{ */
last_up = time (NULL) - 10;
ssnprintf (pdp_step_str, sizeof (pdp_step_str), "%lu", pdp_step);
last_up = time (NULL) - 10;
ssnprintf (pdp_step_str, sizeof (pdp_step_str), "%lu", pdp_step);
- ssnprintf (last_up_str, sizeof (last_up_str), "%
u", (unsigned int
) last_up);
+ ssnprintf (last_up_str, sizeof (last_up_str), "%
lu", (unsigned long
) last_up);
new_argv[0] = "create";
new_argv[1] = (void *) filename;
new_argv[0] = "create";
new_argv[1] = (void *) filename;
@@
-368,6
+373,8
@@
int cu_rrd_create_file (const char *filename, /* {{{ */
char **ds_def;
int ds_num;
int status = 0;
char **ds_def;
int ds_num;
int status = 0;
+ time_t last_up;
+ int stepsize;
if (check_create_dir (filename))
return (-1);
if (check_create_dir (filename))
return (-1);
@@
-398,10
+405,19
@@
int cu_rrd_create_file (const char *filename, /* {{{ */
memcpy (argv + ds_num, rra_def, rra_num * sizeof (char *));
argv[ds_num + rra_num] = NULL;
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;
+
+ if (cfg->stepsize > 0)
+ stepsize = cfg->stepsize;
+ else
+ stepsize = (int) CDTIME_T_TO_TIME_T (vl->interval);
+
assert (vl->time > 10);
status = srrd_create (filename,
assert (vl->time > 10);
status = srrd_create (filename,
- (cfg->stepsize > 0) ? cfg->stepsize : vl->interval,
- vl->time - 10,
+ stepsize, last_up,
argc, (const char **) argv);
free (argv);
argc, (const char **) argv);
free (argv);