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:
Miroslav Lichvar
2026-01-29 09:29:30 +01:00
parent c51c7f5a81
commit e313f5abf7
5 changed files with 16 additions and 19 deletions

View File

@@ -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;
}