diff --git a/acquire.c b/acquire.c index a681b34..29003e7 100644 --- 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, diff --git a/ntp_io.c b/ntp_io.c index 8f6631e..3dc4ace 100644 --- 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); diff --git a/rtc_linux.c b/rtc_linux.c index 2ef4c2d..500af30 100644 --- a/rtc_linux.c +++ b/rtc_linux.c @@ -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 d8e4b6f..321c16f 100644 --- 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 341ce40..d3f62f7 100644 --- 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);