]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Add PPS support to SOCK driver
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 24 Nov 2009 16:16:24 +0000 (17:16 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 25 Nov 2009 13:37:40 +0000 (14:37 +0100)
chrony.texi
refclock_sock.c

index 3629d3522f977117e970dccf63ceecb012c7d655..90bb260992e6b074d60a951b720545862d4140e8 100644 (file)
@@ -2176,9 +2176,10 @@ Software that can be used as a source of timestamps includes
 @item SOCK
 Unix domain socket driver.  The parameter is a path to the socket
 which is used as the source of timestamps.  This is as a better
-alternative to SHM, it does not require polling and the offset
-resolution is not limited to microsecond.  The format for messages
-sent over the socket is declared in file @code{refclock_sock.c}.
+alternative to SHM, it does not require polling, the offset
+resolution is not limited to microsecond and it supports PPS.
+The format for messages sent over the socket is declared in file
+@code{refclock_sock.c}.
 @end table
 
 The @code{refclock} command also supports a number of subfields (which
index c141010d86ae15f0100b4a910cd23e36396693ee..91dbbc9c1f3798034f88dfc18132b1c89f08b16f 100644 (file)
@@ -38,6 +38,7 @@
 struct sock_sample {
   struct timeval tv;
   double offset;
+  int pulse;
   int leap;
 };
 
@@ -53,7 +54,11 @@ static void read_sample(void *anything)
   if (recv(sockfd, &sample, sizeof (sample), 0) != sizeof (sample))
     return;
 
-  RCL_AddSample(instance, &sample.tv, sample.offset, sample.leap);
+  if (sample.pulse) {
+    RCL_AddPulse(instance, &sample.tv, sample.offset);
+  } else {
+    RCL_AddSample(instance, &sample.tv, sample.offset, sample.leap);
+  }
 }
 
 static int sock_initialise(RCL_Instance instance)