Different systems may consider different time values to be valid.
Don't exit on settimeofday()/adjtimex() error in case the check in
UTI_IsTimeOffsetSane() isn't restrictive enough.
if (!check_offset(&raw, offset))
return 0;
- (*drv_apply_step_offset)(offset);
+ if (!(*drv_apply_step_offset)(offset)) {
+ LOG(LOGS_ERR, LOGF_Local, "Could not step clock");
+ return 0;
+ }
/* Reset smoothing on all clock steps */
SMT_Reset(&cooked);
/* System driver to apply a step offset. A positive argument means step
the clock forwards. */
-typedef void (*lcl_ApplyStepOffsetDriver)(double offset);
+typedef int (*lcl_ApplyStepOffsetDriver)(double offset);
/* System driver to convert a raw time to an adjusted (cooked) time.
The number of seconds returned in 'corr' have to be added to the
/* ================================================== */
/* Positive means currently fast of true time, i.e. jump backwards */
-static void
+static int
apply_step_offset(double offset)
{
struct timeval old_time, new_time;
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
if (settimeofday(&new_time, NULL) < 0) {
- LOG_FATAL(LOGF_SysGeneric, "settimeofday() failed");
+ DEBUG_LOG(LOGF_SysGeneric, "settimeofday() failed");
+ return 0;
}
LCL_ReadRawTime(&old_time);
UTI_DiffTimevalsToDouble(&err, &old_time, &new_time);
lcl_InvokeDispersionNotifyHandlers(fabs(err));
+
+ return 1;
}
/* ================================================== */
/* ================================================== */
/* Positive means currently fast of true time, i.e. jump backwards */
-static void
+static int
apply_step_offset(double offset)
{
if (TMX_ApplyStepOffset(-offset) < 0) {
- LOG_FATAL(LOGF_SysLinux, "adjtimex() failed");
+ DEBUG_LOG(LOGF_SysLinux, "adjtimex() failed");
+ return 0;
}
+
+ return 1;
}
/* ================================================== */
/* Positive offset means system clock is fast of true time, therefore
step backwards */
-static void
+static int
apply_step_offset(double offset)
{
struct timeval old_time, new_time, T1;
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
if (settimeofday(&new_time, NULL) < 0) {
- LOG_FATAL(LOGF_SysNetBSD, "settimeofday() failed");
+ DEBUG_LOG(LOGF_SysNetBSD, "settimeofday() failed");
+ return 0;
}
UTI_AddDoubleToTimeval(&T0, offset, &T1);
start_adjust();
+ return 1;
}
/* ================================================== */
/* Positive offset means system clock is fast of true time, therefore
step backwards */
-static void
+static int
apply_step_offset(double offset)
{
struct timeval old_time, new_time, rounded_new_time, T1;
UTI_DiffTimevalsToDouble(&rounding_error, &rounded_new_time, &new_time);
if (settimeofday(&new_time, NULL) < 0) {
- LOG_FATAL(LOGF_SysSolaris, "settimeofday() failed");
+ DEBUG_LOG(LOGF_SysSolaris, "settimeofday() failed");
+ return 0;
}
UTI_AddDoubleToTimeval(&T0, offset, &T1);
offset_register += rounding_error;
start_adjust();
+
+ return 1;
}
/* ================================================== */
/* Positive offset means system clock is fast of true time, therefore
step backwards */
-static void
+static int
apply_step_offset(double offset)
{
struct timeval old_time, new_time, T1;
UTI_AddDoubleToTimeval(&old_time, -offset, &new_time);
if (settimeofday(&new_time, NULL) < 0) {
- LOG_FATAL(LOGF_SysSunOS, "settimeofday() failed");
+ DEBUG_LOG(LOGF_SysSunOS, "settimeofday() failed");
+ return 0;
}
UTI_AddDoubleToTimeval(&T0, offset, &T1);
start_adjust();
+ return 1;
}
/* ================================================== */