From: Miroslav Lichvar Date: Mon, 8 Jun 2015 13:07:18 +0000 (+0200) Subject: cmdmon: use SCH_GetLastEventTime() to get current time X-Git-Tag: 2.1-pre1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee038d5de5690844a8eda9e118e508e7307497ef;p=thirdparty%2Fchrony.git cmdmon: use SCH_GetLastEventTime() to get current time It's cheaper and accurate enough. --- diff --git a/cmdmon.c b/cmdmon.c index 802975a8..c569a805 100644 --- a/cmdmon.c +++ b/cmdmon.c @@ -945,7 +945,7 @@ handle_source_data(CMD_Request *rx_message, CMD_Reply *tx_message) struct timeval now_corr; /* Get data */ - LCL_ReadCookedTime(&now_corr, NULL); + SCH_GetLastEventTime(&now_corr, NULL, NULL); if (SRC_ReportSource(ntohl(rx_message->data.source_data.index), &report, &now_corr)) { switch (SRC_GetType(ntohl(rx_message->data.source_data.index))) { case SRC_NTP: @@ -1230,7 +1230,7 @@ handle_sourcestats(CMD_Request *rx_message, CMD_Reply *tx_message) RPT_SourcestatsReport report; struct timeval now_corr; - LCL_ReadCookedTime(&now_corr, NULL); + SCH_GetLastEventTime(&now_corr, NULL, NULL); status = SRC_ReportSourcestats(ntohl(rx_message->data.sourcestats.index), &report, &now_corr); @@ -1300,7 +1300,7 @@ handle_client_accesses_by_index(CMD_Request *rx_message, CMD_Reply *tx_message) int i, j; struct timeval now; - LCL_ReadCookedTime(&now, NULL); + SCH_GetLastEventTime(&now, NULL, NULL); first_index = ntohl(rx_message->data.client_accesses_by_index.first_index); n_indices = ntohl(rx_message->data.client_accesses_by_index.n_indices); @@ -1471,8 +1471,8 @@ read_from_cmd_socket(void *anything) read_length = status; - LCL_ReadRawTime(&now); - LCL_CookTime(&now, &cooked_now, NULL); + /* Get current time cheaply */ + SCH_GetLastEventTime(&cooked_now, NULL, &now); UTI_SockaddrToIPAndPort(&where_from.u, &remote_ip, &remote_port);