diff --git a/local.c b/local.c index f81c35d..ef4f66b 100644 --- a/local.c +++ b/local.c @@ -528,7 +528,10 @@ LCL_ApplyStepOffset(double offset) 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); diff --git a/localp.h b/localp.h index 321985e..5f99309 100644 --- a/localp.h +++ b/localp.h @@ -47,7 +47,7 @@ typedef void (*lcl_AccrueOffsetDriver)(double offset, double corr_rate); /* 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 diff --git a/sys_generic.c b/sys_generic.c index 44cb251..41e36ff 100644 --- a/sys_generic.c +++ b/sys_generic.c @@ -250,7 +250,7 @@ offset_convert(struct timeval *raw, /* ================================================== */ /* 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; @@ -260,13 +260,16 @@ apply_step_offset(double offset) 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; } /* ================================================== */ diff --git a/sys_linux.c b/sys_linux.c index d57dde3..e5ca9a6 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -100,12 +100,15 @@ our_round(double x) /* ================================================== */ /* 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; } /* ================================================== */ diff --git a/sys_netbsd.c b/sys_netbsd.c index c54de3f..237f35f 100644 --- a/sys_netbsd.c +++ b/sys_netbsd.c @@ -212,7 +212,7 @@ accrue_offset(double offset, double corr_rate) /* 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; @@ -226,7 +226,8 @@ apply_step_offset(double offset) 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); @@ -234,6 +235,7 @@ apply_step_offset(double offset) start_adjust(); + return 1; } /* ================================================== */ diff --git a/sys_solaris.c b/sys_solaris.c index 2802a90..fe8b63a 100644 --- a/sys_solaris.c +++ b/sys_solaris.c @@ -219,7 +219,7 @@ accrue_offset(double offset, double corr_rate) /* 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; @@ -248,7 +248,8 @@ apply_step_offset(double offset) 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); @@ -257,6 +258,8 @@ apply_step_offset(double offset) offset_register += rounding_error; start_adjust(); + + return 1; } /* ================================================== */ diff --git a/sys_sunos.c b/sys_sunos.c index 9231dca..7d0737e 100644 --- a/sys_sunos.c +++ b/sys_sunos.c @@ -223,7 +223,7 @@ accrue_offset(double offset, double corr_rate) /* 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; @@ -236,7 +236,8 @@ apply_step_offset(double offset) 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); @@ -244,6 +245,7 @@ apply_step_offset(double offset) start_adjust(); + return 1; } /* ================================================== */