X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fonewire.c;h=0266e9b76cedfab62b0b1184ecea7e757644b871;hb=eae3f57d9a826e015ef952c746675c2aff8592dc;hp=cae0d63d4c22f529aab642a3e3f6dd37e8195fb4;hpb=f9d51dc8fabe44f3cd17499713d63b518f0e1853;p=collectd.git diff --git a/src/onewire.c b/src/onewire.c index cae0d63d..0266e9b7 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -59,7 +59,7 @@ static ow_family_features_t ow_family_features[] = static int ow_family_features_num = STATIC_ARRAY_SIZE (ow_family_features); static char *device_g = NULL; -static int ow_interval = 0; +static cdtime_t ow_interval = 0; static const char *config_keys[] = { @@ -106,10 +106,10 @@ static int cow_load_config (const char *key, const char *value) } else if (strcasecmp ("Interval", key) == 0) { - int tmp; - tmp = atoi (value); - if (tmp > 0) - ow_interval = tmp; + double tmp; + tmp = atof (value); + if (tmp > 0.0) + ow_interval = DOUBLE_TO_CDTIME_T (tmp); else ERROR ("onewire plugin: Invalid `Interval' setting: %s", value); } @@ -171,7 +171,6 @@ static int cow_read_values (const char *path, const char *name, if (endptr == NULL) { ERROR ("onewire plugin: Buffer is not a number: %s", buffer); - status = -1; continue; } @@ -306,12 +305,11 @@ static int cow_init (void) return (1); } - memset (&cb_interval, 0, sizeof (cb_interval)); - if (ow_interval > 0) - cb_interval.tv_sec = (time_t) ow_interval; + CDTIME_T_TO_TIMESPEC (ow_interval, &cb_interval); - plugin_register_complex_read ("onewire", cow_read, - &cb_interval, /* user data = */ NULL); + plugin_register_complex_read (/* group = */ NULL, "onewire", cow_read, + (ow_interval != 0) ? &cb_interval : NULL, + /* user data = */ NULL); plugin_register_shutdown ("onewire", cow_shutdown); return (0);