summaryrefslogtreecommitdiffstats
path: root/src/collectors/timex.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/collectors/timex.plugin')
-rw-r--r--src/collectors/timex.plugin/integrations/timex.md4
-rw-r--r--src/collectors/timex.plugin/plugin_timex.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/collectors/timex.plugin/integrations/timex.md b/src/collectors/timex.plugin/integrations/timex.md
index 98bcbe10b..5d758857c 100644
--- a/src/collectors/timex.plugin/integrations/timex.md
+++ b/src/collectors/timex.plugin/integrations/timex.md
@@ -102,8 +102,8 @@ The file format is a modified INI syntax. The general structure is:
[section2]
option3 = some third value
```
-You can edit the configuration file using the `edit-config` script from the
-Netdata [config directory](/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
+You can edit the configuration file using the [`edit-config`](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#edit-a-configuration-file-using-edit-config) script from the
+Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration/README.md#the-netdata-config-directory).
```bash
cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
diff --git a/src/collectors/timex.plugin/plugin_timex.c b/src/collectors/timex.plugin/plugin_timex.c
index 6e200c425..381079cf4 100644
--- a/src/collectors/timex.plugin/plugin_timex.c
+++ b/src/collectors/timex.plugin/plugin_timex.c
@@ -50,9 +50,11 @@ void *timex_main(void *ptr)
worker_register("TIMEX");
worker_register_job_name(0, "clock check");
- int update_every = (int)config_get_number(CONFIG_SECTION_TIMEX, "update every", 10);
- if (update_every < localhost->rrd_update_every)
+ int update_every = (int)config_get_duration_seconds(CONFIG_SECTION_TIMEX, "update every", 10);
+ if (update_every < localhost->rrd_update_every) {
update_every = localhost->rrd_update_every;
+ config_set_duration_seconds(CONFIG_SECTION_TIMEX, "update every", update_every);
+ }
int do_sync = config_get_boolean(CONFIG_SECTION_TIMEX, "clock synchronization state", CONFIG_BOOLEAN_YES);
int do_offset = config_get_boolean(CONFIG_SECTION_TIMEX, "time offset", CONFIG_BOOLEAN_YES);
@@ -65,10 +67,10 @@ void *timex_main(void *ptr)
usec_t step = update_every * USEC_PER_SEC;
usec_t real_step = USEC_PER_SEC;
heartbeat_t hb;
- heartbeat_init(&hb);
+ heartbeat_init(&hb, USEC_PER_SEC);
while (service_running(SERVICE_COLLECTORS)) {
worker_is_idle();
- heartbeat_next(&hb, USEC_PER_SEC);
+ heartbeat_next(&hb);
if (real_step < step) {
real_step += USEC_PER_SEC;