diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-02-06 13:31:34 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-02-06 13:31:34 -0500 |
commit | 20d0936fa256e0caa41a18a79556c8ade3f8347f (patch) | |
tree | 230424417d2f1b0c148d677ecf3d1003dfd943ac /klippy/serialqueue.c | |
parent | c24b7a7ef96b6c9770fdf4c821f5719892732033 (diff) | |
download | kutter-20d0936fa256e0caa41a18a79556c8ade3f8347f.tar.gz kutter-20d0936fa256e0caa41a18a79556c8ade3f8347f.tar.xz kutter-20d0936fa256e0caa41a18a79556c8ade3f8347f.zip |
reactor: Use the system monotonic clock instead of the normal system clock
The normal system clock can have sudden jumps if the system clock is
changed. Use the system monotonic clock to avoid these sudden changes
in time.
It appears the Raspbian OS (which is used by OctoPi) is setup to
update the system clock upon network connectivity. This could cause
sudden system clock changes which could lead to Klippy processing
errors. Using the monotonic clock eliminates these issues.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/serialqueue.c')
-rw-r--r-- | klippy/serialqueue.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c index 6cdd9f77..2286912a 100644 --- a/klippy/serialqueue.c +++ b/klippy/serialqueue.c @@ -23,7 +23,7 @@ #include <termios.h> // tcflush #include <unistd.h> // pipe #include "list.h" // list_add_tail -#include "pyhelper.h" // get_time +#include "pyhelper.h" // get_monotonic #include "serialqueue.h" // struct queue_message @@ -149,11 +149,11 @@ static void pollreactor_run(struct pollreactor *pr) { pr->must_exit = 0; - double eventtime = get_time(); + double eventtime = get_monotonic(); while (! pr->must_exit) { int timeout = pollreactor_check_timers(pr, eventtime); int ret = poll(pr->fds, pr->num_fds, timeout); - eventtime = get_time(); + eventtime = get_monotonic(); if (ret > 0) { int i; for (i=0; i<pr->num_fds; i++) |