use CLOCK_MONOTONIC instead of CLOCK_REALTIME for timer setup
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 01 Jun 2018 12:21:37 +0300
changeset 2171 d1536c271866
parent 2170 ce5bd74ed552
child 2172 9fa5be79bb77
use CLOCK_MONOTONIC instead of CLOCK_REALTIME for timer setup

CLOCK_REALTIME is a wall clock, that could change back and forth (user
changes system time, winter/summer time, NTP corrections and so on).
For real-time application CLOCK_MONOTONIC should be used, it doesn't
have such jumps.
targets/Linux/plc_Linux_main.c
--- a/targets/Linux/plc_Linux_main.c	Thu May 31 13:07:10 2018 +0300
+++ b/targets/Linux/plc_Linux_main.c	Fri Jun 01 12:21:37 2018 +0300
@@ -117,7 +117,7 @@
     pthread_mutex_lock(&debug_wait_mutex);
     pthread_mutex_lock(&python_wait_mutex);
 
-    timer_create (CLOCK_REALTIME, &sigev, &PLC_timer);
+    timer_create (CLOCK_MONOTONIC, &sigev, &PLC_timer);
     if(  __init(argc,argv) == 0 ){
         PLC_SetTimer(common_ticktime__,common_ticktime__);