mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-03-11 00:59:38 -04:00
privops: switch from settimeofday() to clock_settime()
Following the removal of gettimeofday() calls, change PRV_SetTime() to use clock_settime() instead of settimeofday(). Only CLOCK_REALTIME is supported for now.
This commit is contained in:
@@ -349,15 +349,13 @@ static int
|
||||
apply_step_offset(double offset)
|
||||
{
|
||||
struct timespec old_time, new_time;
|
||||
struct timeval new_time_tv;
|
||||
double err;
|
||||
|
||||
LCL_ReadRawTime(&old_time);
|
||||
UTI_AddDoubleToTimespec(&old_time, -offset, &new_time);
|
||||
UTI_TimespecToTimeval(&new_time, &new_time_tv);
|
||||
|
||||
if (PRV_SetTime(&new_time_tv, NULL) < 0) {
|
||||
DEBUG_LOG("settimeofday() failed");
|
||||
if (PRV_SetTime(CLOCK_REALTIME, &new_time) < 0) {
|
||||
DEBUG_LOG("clock_settime() failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user