Rename SCH_GetFileReadyTime() and extend it to return raw time

This commit is contained in:
Miroslav Lichvar 2013-06-05 17:52:13 +02:00
parent 0074135097
commit 58f768928a
5 changed files with 13 additions and 10 deletions

View file

@ -449,7 +449,7 @@ read_from_socket(void *anything)
his_addr_len = sizeof(his_addr); his_addr_len = sizeof(his_addr);
/* Get timestamp */ /* Get timestamp */
SCH_GetFileReadyTime(&now, NULL); SCH_GetLastEventTime(&now, NULL, NULL);
sock_fd = (long)anything; sock_fd = (long)anything;
status = recvfrom (sock_fd, (char *)&msg, message_length, flags, status = recvfrom (sock_fd, (char *)&msg, message_length, flags,

View file

@ -306,7 +306,7 @@ read_from_socket(void *anything)
assert(initialised); assert(initialised);
SCH_GetFileReadyTime(&now, &now_err); SCH_GetLastEventTime(&now, &now_err, NULL);
iov.iov_base = message.arbitrary; iov.iov_base = message.arbitrary;
iov.iov_len = sizeof(message); iov.iov_len = sizeof(message);

View file

@ -789,7 +789,7 @@ read_from_device(void *any)
/* Read RTC time, sandwiched between two polls of the system clock /* Read RTC time, sandwiched between two polls of the system clock
so we can bound any error. */ 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); status = ioctl(fd, RTC_RD_TIME, &rtc_raw);
if (status < 0) { if (status < 0) {

12
sched.c
View file

@ -219,11 +219,15 @@ SCH_RemoveInputFileHandler(int fd)
/* ================================================== */ /* ================================================== */
void void
SCH_GetFileReadyTime(struct timeval *tv, double *err) SCH_GetLastEventTime(struct timeval *cooked, double *err, struct timeval *raw)
{ {
*tv = last_select_ts; if (cooked) {
if (err) *cooked = last_select_ts;
*err = last_select_ts_err; if (err)
*err = last_select_ts_err;
}
if (raw)
*raw = last_select_ts_raw;
} }
/* ================================================== */ /* ================================================== */

View file

@ -58,9 +58,8 @@ extern void SCH_AddInputFileHandler
); );
extern void SCH_RemoveInputFileHandler(int fd); extern void SCH_RemoveInputFileHandler(int fd);
/* Get the time (cooked) when file descriptor became ready, intended for use /* Get the time stamp taken after a file descriptor became ready or a timeout expired */
in file handlers */ extern void SCH_GetLastEventTime(struct timeval *cooked, double *err, struct timeval *raw);
extern void SCH_GetFileReadyTime(struct timeval *tv, double *err);
/* This queues a timeout to elapse at a given (raw) local time */ /* This queues a timeout to elapse at a given (raw) local time */
extern SCH_TimeoutID SCH_AddTimeout(struct timeval *tv, SCH_TimeoutHandler, SCH_ArbitraryArgument); extern SCH_TimeoutID SCH_AddTimeout(struct timeval *tv, SCH_TimeoutHandler, SCH_ArbitraryArgument);