From: Florian Forster Date: Sun, 31 Oct 2010 12:09:51 +0000 (+0100) Subject: Various plugins: Some more fixes with the time_t → cdtime_t change. X-Git-Tag: collectd-5.0.0-beta0~19^2~17 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d4e70c2b352c616bbfe1da195d6cbbacedcb7292;p=collectd.git Various plugins: Some more fixes with the time_t → cdtime_t change. --- diff --git a/src/rrdcached.c b/src/rrdcached.c index 34e860ba..fb7eb79e 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -64,12 +64,14 @@ static int value_list_to_string (char *buffer, int buffer_len, int offset; int status; int i; + time_t t; assert (0 == strcmp (ds->type, vl->type)); memset (buffer, '\0', buffer_len); - status = ssnprintf (buffer, buffer_len, "%u", (unsigned int) vl->time); + t = CDTIME_T_TO_TIME_T (vl->time); + status = ssnprintf (buffer, buffer_len, "%lu", (unsigned long) t); if ((status < 1) || (status >= buffer_len)) return (-1); offset = status; diff --git a/src/target_notification.c b/src/target_notification.c index 96598afd..cb68048b 100644 --- a/src/target_notification.c +++ b/src/target_notification.c @@ -209,7 +209,7 @@ static int tn_invoke (const data_set_t *ds, value_list_t *vl, /* {{{ */ /* Initialize the structure. */ memset (&n, 0, sizeof (n)); n.severity = data->severity; - n.time = time (NULL); + n.time = cdtime (); sstrncpy (n.message, data->message, sizeof (n.message)); sstrncpy (n.host, vl->host, sizeof (n.host)); sstrncpy (n.plugin, vl->plugin, sizeof (n.plugin)); diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index 4ecec59d..5f21a17b 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -323,7 +323,7 @@ static int srrd_create (const char *filename, /* {{{ */ 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; @@ -368,6 +368,7 @@ int cu_rrd_create_file (const char *filename, /* {{{ */ char **ds_def; int ds_num; int status = 0; + time_t last_up; if (check_create_dir (filename)) return (-1); @@ -398,10 +399,15 @@ 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; + assert (vl->time > 10); status = srrd_create (filename, (cfg->stepsize > 0) ? cfg->stepsize : vl->interval, - vl->time - 10, + last_up, argc, (const char **) argv); free (argv);