X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fonewire.c;h=d308122accc1f4953e4f2cb7e17daa943bd0157f;hb=edd0e2639a241167e213ec301bfc71c7d291ee61;hp=cae0d63d4c22f529aab642a3e3f6dd37e8195fb4;hpb=c3533f89f324411112a8b80d7ff0d7afd1e70b5d;p=collectd.git diff --git a/src/onewire.c b/src/onewire.c index cae0d63d..d308122a 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -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); } @@ -306,11 +306,9 @@ 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, + plugin_register_complex_read (/* group = */ NULL, "onewire", cow_read, &cb_interval, /* user data = */ NULL); plugin_register_shutdown ("onewire", cow_shutdown);