mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-03-12 17:49:38 -04:00
client+test: switch from gettimeofday() to clock_gettime()
Replace the remaining calls of gettimeofday().
This commit is contained in:
6
client.c
6
client.c
@@ -1396,7 +1396,7 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
|
||||
new_attempt = 1;
|
||||
|
||||
do {
|
||||
if (gettimeofday(&tv, NULL))
|
||||
if (clock_gettime(CLOCK_REALTIME, &ts_now) < 0)
|
||||
return 0;
|
||||
|
||||
if (new_attempt) {
|
||||
@@ -1405,7 +1405,7 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
|
||||
if (n_attempts > max_retries)
|
||||
return 0;
|
||||
|
||||
UTI_TimevalToTimespec(&tv, &ts_start);
|
||||
ts_start = ts_now;
|
||||
|
||||
UTI_GetRandomBytes(&request->sequence, sizeof (request->sequence));
|
||||
request->attempt = htons(n_attempts);
|
||||
@@ -1428,8 +1428,6 @@ submit_request(CMD_Request *request, CMD_Reply *reply)
|
||||
return 0;
|
||||
}
|
||||
|
||||
UTI_TimevalToTimespec(&tv, &ts_now);
|
||||
|
||||
/* Check if the clock wasn't stepped back */
|
||||
if (UTI_CompareTimespecs(&ts_now, &ts_start) < 0)
|
||||
ts_start = ts_now;
|
||||
|
||||
Reference in New Issue
Block a user