BE WARNED - certain software will be seriously affected by such jumps to
the system time. (That is the reason why chronyd uses slewing
normally.)
-
-The @code{makestep} command is currently only available on the Linux
-version of chrony.
@c }}}
@c {{{ manual
@node manual command
static lcl_AccrueOffsetDriver drv_accrue_offset;
static lcl_ApplyStepOffsetDriver drv_apply_step_offset;
static lcl_OffsetCorrectionDriver drv_offset_convert;
-static lcl_ImmediateStepDriver drv_immediate_step;
static lcl_SetLeapDriver drv_set_leap;
/* ================================================== */
lcl_AccrueOffsetDriver accrue_offset,
lcl_ApplyStepOffsetDriver apply_step_offset,
lcl_OffsetCorrectionDriver offset_convert,
- lcl_ImmediateStepDriver immediate_step,
lcl_SetLeapDriver set_leap)
{
drv_read_freq = read_freq;
drv_accrue_offset = accrue_offset;
drv_apply_step_offset = apply_step_offset;
drv_offset_convert = offset_convert;
- drv_immediate_step = immediate_step;
drv_set_leap = set_leap;
current_freq_ppm = (*drv_read_freq)();
int
LCL_MakeStep(void)
{
- if (drv_immediate_step) {
- (drv_immediate_step)();
-#ifdef TRACEON
- LOG(LOGS_INFO, LOGF_Local, "Made step to system time to apply remaining slew");
-#endif
- return 1;
- }
+ struct timeval raw;
+ double correction;
+
+ LCL_ReadRawTime(&raw);
+ correction = LCL_GetOffsetCorrection(&raw);
+
+ /* Cancel remaining slew and make the step */
+ LCL_AccumulateOffset(correction);
+ LCL_ApplyStepOffset(-correction);
+
+ LOG(LOGS_WARN, LOGF_Local, "System clock was stepped by %.3f seconds", correction);
- return 0;
+ return 1;
}
/* ================================================== */
raw time to get the corrected time */
typedef void (*lcl_OffsetCorrectionDriver)(struct timeval *raw, double *corr);
-/* System driver to stop slewing the current offset and to apply is
- as an immediate step instead */
-typedef void (*lcl_ImmediateStepDriver)(void);
-
/* System driver to schedule leap second */
typedef void (*lcl_SetLeapDriver)(int leap);
lcl_AccrueOffsetDriver accrue_offset,
lcl_ApplyStepOffsetDriver apply_step_offset,
lcl_OffsetCorrectionDriver offset_convert,
- lcl_ImmediateStepDriver immediate_step_driver,
lcl_SetLeapDriver set_leap);
#endif /* GOT_LOCALP_H */
/* ================================================== */
-static void
-immediate_step(void)
-{
- struct timeval old_time, new_time;
- struct timezone tz;
- long offset;
-
- if (fast_slewing) {
- abort_slew();
- }
-
- offset = 0;
- if (TMX_ApplyOffset(&offset) < 0) {
- CROAK("adjtimex() failed in immediate_step");
- }
-
- offset_register -= (double) offset / 1.0e6;
- slow_slewing = 0;
-
- if (gettimeofday(&old_time, &tz) < 0) {
- CROAK("gettimeofday() failed in immediate_step");
- }
-
- UTI_AddDoubleToTimeval(&old_time, -offset_register, &new_time);
-
- if (settimeofday(&new_time, &tz) < 0) {
- CROAK("settimeofday() failed in immediate_step");
- }
-
- offset_register = 0.0;
-
- return;
-}
-
-/* ================================================== */
-
static void
set_leap(int leap)
{
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
accrue_offset, apply_step_offset,
- get_offset_correction, immediate_step, set_leap);
+ get_offset_correction, set_leap);
}
/* ================================================== */
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
accrue_offset, apply_step_offset,
- get_offset_correction, NULL /* immediate_step */,
+ get_offset_correction,
NULL /* set_leap */);
}
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
accrue_offset, apply_step_offset,
- get_offset_correction, NULL /* immediate_step */,
+ get_offset_correction,
NULL /* set_leap */);
/* Turn off the kernel switch that keeps the system clock in step
lcl_RegisterSystemDrivers(read_frequency, set_frequency,
accrue_offset, apply_step_offset,
- get_offset_correction, NULL /* immediate_step */,
+ get_offset_correction,
NULL /* set_leap */);
/* Turn off the kernel switch that keeps the system clock in step