]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Move to using CLOCK_MONOLITHIC_RAW to avoid NTP effects. Increase bias towards positi...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 28 Nov 2021 16:05:49 +0000 (16:05 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sun, 28 Nov 2021 16:05:49 +0000 (16:05 +0000)
general-utilities.c
nqptp-message-handlers.c
nqptp-shm-structures.h

index 1a89578f2e521e2bc362a7de21fc21e8164799d2..6af29774c410e5a106c994ed63ecf609f1892923 100644 (file)
@@ -66,6 +66,6 @@ uint64_t timespec_to_ns(struct timespec *tn) {
 
 uint64_t get_time_now() {
   struct timespec tn;
-  clock_gettime(CLOCK_REALTIME, &tn); // this should be optionally CLOCK_MONOTONIC etc.
+  clock_gettime(CLOCK_MONOTONIC_RAW, &tn);
   return timespec_to_ns(&tn);
 }
index 562a57e41eebb03dedaa1cc5108553970648d331..1637111e507f691de7511c664862ee969a4a2051 100644 (file)
@@ -387,11 +387,11 @@ void handle_follow_up(char *buf, __attribute__((unused)) ssize_t recv_len,
       if (jitter > -10000000) {
         // we take any positive or a limited negative jitter as a sync event
         if (jitter < 0)
-          offset = clock_private_info->previous_offset + jitter / 16;
+          offset = clock_private_info->previous_offset + jitter / 32;
         else if (clock_private_info->follow_up_number < (5 * 8)) // at the beginning (8 samples per second)
           offset = clock_private_info->previous_offset + jitter / 2; // accept positive changes quickly
         else
-          offset = clock_private_info->previous_offset + jitter / 16;
+          offset = clock_private_info->previous_offset + jitter / 2;
         clock_private_info->last_sync_time = reception_time;
       } else {
         offset = clock_private_info->previous_offset; // forget the present sample...
index 36c8a8131da355033f21c30a320fed7a0fd1fd16..f4db8c6e291d95aeeaa83fe0e4a469c79a07f658 100644 (file)
@@ -22,7 +22,7 @@
 
 #define STORAGE_ID "/nqptp"
 #define MAX_CLOCKS 32
-#define NQPTP_SHM_STRUCTURES_VERSION 5
+#define NQPTP_SHM_STRUCTURES_VERSION 6
 #define NQPTP_CONTROL_PORT 9000
 
 // the control port will accept a UDP packet with the first letter being: