mirror of
https://gitlab.com/chrony/chrony.git
synced 2026-03-11 00:59:38 -04:00
sys_macosx: fix macOS driver using timeval instead of timespec
The macOS driver was using the old settimeofday() variables. Now uses
timespec as required by updated PRV_SetTime().
Fixes: e313f5abf7 ("privops: switch from settimeofday() to clock_settime()")
This commit is contained in:
committed by
Miroslav Lichvar
parent
e313f5abf7
commit
27f31aa6c3
@@ -236,16 +236,14 @@ static int
|
|||||||
apply_step_offset(double offset)
|
apply_step_offset(double offset)
|
||||||
{
|
{
|
||||||
struct timespec old_time, new_time, T1;
|
struct timespec old_time, new_time, T1;
|
||||||
struct timeval new_time_tv;
|
|
||||||
|
|
||||||
stop_adjust();
|
stop_adjust();
|
||||||
|
|
||||||
LCL_ReadRawTime(&old_time);
|
LCL_ReadRawTime(&old_time);
|
||||||
|
|
||||||
UTI_AddDoubleToTimespec(&old_time, -offset, &new_time);
|
UTI_AddDoubleToTimespec(&old_time, -offset, &new_time);
|
||||||
UTI_TimespecToTimeval(&new_time, &new_time_tv);
|
|
||||||
|
|
||||||
if (PRV_SetTime(CLOCK_REALTIME, &new_time_tv) < 0) {
|
if (PRV_SetTime(CLOCK_REALTIME, &new_time) < 0) {
|
||||||
DEBUG_LOG("clock_settime() failed");
|
DEBUG_LOG("clock_settime() failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user