X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fonewire.c;h=486e47136a1e9bdae5f532cdcaff5ec0af420b91;hp=cae0d63d4c22f529aab642a3e3f6dd37e8195fb4;hb=633c3966f770e4d46651a2fe219a18d8a9907a9f;hpb=d48a9456e42af4ab5881ab055c95ceab71819bc1 diff --git a/src/onewire.c b/src/onewire.c index cae0d63d..486e4713 100644 --- a/src/onewire.c +++ b/src/onewire.c @@ -1,6 +1,6 @@ /** - * collectd - src/owfs.c - * Copyright (C) 2008 Florian octo Forster + * collectd - src/onewire.c + * Copyright (C) 2008 noris network AG * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -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); } @@ -306,12 +306,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);