]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Rename SCH_GetFileReadyTime() and extend it to return raw time
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Jun 2013 15:52:13 +0000 (17:52 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Jun 2013 16:07:05 +0000 (18:07 +0200)
acquire.c
ntp_io.c
rtc_linux.c
sched.c
sched.h

index a681b34ebe9e7edde68712d19ff48f9e9e9bbd99..29003e73634b418db2989069b939c55b169bab1f 100644 (file)
--- a/acquire.c
+++ b/acquire.c
@@ -449,7 +449,7 @@ read_from_socket(void *anything)
   his_addr_len = sizeof(his_addr);
 
   /* Get timestamp */
-  SCH_GetFileReadyTime(&now, NULL);
+  SCH_GetLastEventTime(&now, NULL, NULL);
 
   sock_fd = (long)anything;
   status = recvfrom (sock_fd, (char *)&msg, message_length, flags,
index 8f6631e7d2d30244952fa2f38a326a9d71fbe116..3dc4ace93ddc8971f9a6216b9fe76f565625331e 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -306,7 +306,7 @@ read_from_socket(void *anything)
 
   assert(initialised);
 
-  SCH_GetFileReadyTime(&now, &now_err);
+  SCH_GetLastEventTime(&now, &now_err, NULL);
 
   iov.iov_base = message.arbitrary;
   iov.iov_len = sizeof(message);
index 2ef4c2d786fee76377153e357f7fa57f2b51982f..500af307dffab980627348c84db40ae807bc34d7 100644 (file)
@@ -789,7 +789,7 @@ read_from_device(void *any)
     /* Read RTC time, sandwiched between two polls of the system clock
        so we can bound any error. */
 
-    SCH_GetFileReadyTime(&sys_time, NULL);
+    SCH_GetLastEventTime(&sys_time, NULL, NULL);
 
     status = ioctl(fd, RTC_RD_TIME, &rtc_raw);
     if (status < 0) {
diff --git a/sched.c b/sched.c
index d8e4b6fa57a9ce87c676749f0b6f6dd6d0edcc14..321c16f6bc38135f91850ba24f6ef4da278de1ec 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -219,11 +219,15 @@ SCH_RemoveInputFileHandler(int fd)
 /* ================================================== */
 
 void
-SCH_GetFileReadyTime(struct timeval *tv, double *err)
+SCH_GetLastEventTime(struct timeval *cooked, double *err, struct timeval *raw)
 {
-  *tv = last_select_ts;
-  if (err)
-    *err = last_select_ts_err;
+  if (cooked) {
+    *cooked = last_select_ts;
+    if (err)
+      *err = last_select_ts_err;
+  }
+  if (raw)
+    *raw = last_select_ts_raw;
 }
 
 /* ================================================== */
diff --git a/sched.h b/sched.h
index 341ce40b0d5b940bfb8f8f07bf202fd51c8d7c3f..d3f62f7e3ad4ad9e9bd9b55a7046c9b1fcffd178 100644 (file)
--- a/sched.h
+++ b/sched.h
@@ -58,9 +58,8 @@ extern void SCH_AddInputFileHandler
 );
 extern void SCH_RemoveInputFileHandler(int fd);
 
-/* Get the time (cooked) when file descriptor became ready, intended for use
-   in file handlers */
-extern void SCH_GetFileReadyTime(struct timeval *tv, double *err);
+/* Get the time stamp taken after a file descriptor became ready or a timeout expired */
+extern void SCH_GetLastEventTime(struct timeval *cooked, double *err, struct timeval *raw);
 
 /* This queues a timeout to elapse at a given (raw) local time */
 extern SCH_TimeoutID SCH_AddTimeout(struct timeval *tv, SCH_TimeoutHandler, SCH_ArbitraryArgument);