IPAddr remote_ip;
int i, ok;
struct timeval now;
- double local_time_err;
SourceRecord *src;
flags = 0;
his_addr_len = sizeof(his_addr);
/* Get timestamp */
- LCL_ReadCookedTime(&now, &local_time_err);
+ SCH_GetFileReadyTime(&now);
sock_fd = (long)anything;
status = recvfrom (sock_fd, (char *)&msg, message_length, flags,
unsigned int flags = 0;
struct timeval now;
NTP_Remote_Address remote_addr;
- double local_clock_err;
char cmsgbuf[256];
struct msghdr msg;
struct iovec iov;
assert(initialised);
- LCL_ReadCookedTime(&now, &local_clock_err);
+ SCH_GetFileReadyTime(&now);
iov.iov_base = message.arbitrary;
iov.iov_len = sizeof(message);
struct rtc_time rtc_raw;
struct tm rtc_tm;
time_t rtc_t;
- double read_err;
int error = 0;
status = read(fd, &data, sizeof(data));
/* Read RTC time, sandwiched between two polls of the system clock
so we can bound any error. */
- LCL_ReadCookedTime(&sys_time, &read_err);
+ SCH_GetFileReadyTime(&sys_time);
status = ioctl(fd, RTC_RD_TIME, &rtc_raw);
if (status < 0) {
static FileHandlerEntry file_handlers[FD_SET_SIZE];
+/* Last timestamp when a file descriptor became readable */
+static struct timeval last_fdready;
+
/* ================================================== */
/* Variables to handler the timer queue */
/* ================================================== */
+void
+SCH_GetFileReadyTime(struct timeval *tv)
+{
+ *tv = last_fdready;
+}
+
+/* ================================================== */
+
#define TQE_ALLOC_QUANTUM 32
static TimerQueueEntry *
int status;
struct timeval tv, *ptv;
struct timeval now;
+ double err;
if (!initialised) {
CROAK("Should be initialised");
}
status = select(one_highest_fd, &rd, NULL, NULL, ptv);
+ LCL_ReadCookedTime(&last_fdready, &err);
if (status < 0) {
if (!need_to_exit)
);
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);
+
/* This queues a timeout to elapse at a given (raw) local time */
extern SCH_TimeoutID SCH_AddTimeout(struct timeval *tv, SCH_TimeoutHandler, SCH_ArbitraryArgument);