From: Miroslav Lichvar Date: Thu, 5 Aug 2010 11:27:52 +0000 (+0200) Subject: Reset adjtime offset on start X-Git-Tag: 1.25-pre1~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7994b31de40fdeb4678b07ab04d2e43f89aa3bbb;p=thirdparty%2Fchrony.git Reset adjtime offset on start --- diff --git a/sys_linux.c b/sys_linux.c index 64174528..5a7b51fa 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -678,13 +678,10 @@ get_offset_correction(struct timeval *raw, if (!slow_slewing) { offset = 0; } else { -again: switch (have_readonly_adjtime) { case 2: if (TMX_GetOffsetLeft(&offset) < 0) { - LOG(LOGS_INFO, LOGF_SysLinux, "adjtimex() doesn't support ADJ_OFFSET_SS_READ"); - have_readonly_adjtime = 0; - goto again; + CROAK("adjtimex() failed in get_offset_correction"); } break; case 0: @@ -933,18 +930,18 @@ get_version_specific_details(void) have_readonly_adjtime = 0; break; } + if (patch < 33) { + /* Tickless kernels before 2.6.33 accumulated ticks only in + half-second intervals. */ + tick_update_hz = 2; + } /* Let's be optimistic that these will be the same until proven otherwise :-) */ case 7: case 8: - /* These don't need scaling */ + /* These don't seem to need scaling */ freq_scale = 1.0; have_readonly_adjtime = 2; - if (minor == 6 && patch < 33) { - /* Tickless kernels before 2.6.33 accumulated ticks only in - half-second intervals. */ - tick_update_hz = 2; - } break; default: LOG_FATAL(LOGF_SysLinux, "Kernel version not supported yet, sorry."); @@ -971,6 +968,8 @@ get_version_specific_details(void) void SYS_Linux_Initialise(void) { + long offset; + offset_register = 0.0; fast_slewing = 0; @@ -983,6 +982,16 @@ SYS_Linux_Initialise(void) accrue_offset, apply_step_offset, get_offset_correction, set_leap); + offset = 0; + if (TMX_ApplyOffset(&offset) < 0) { + CROAK("adjtimex() failed in initialise"); + } + + if (have_readonly_adjtime == 2 && (TMX_GetOffsetLeft(&offset) < 0 || offset)) { + LOG(LOGS_INFO, LOGF_SysLinux, "adjtimex() doesn't support ADJ_OFFSET_SS_READ"); + have_readonly_adjtime = 0; + } + TMX_SetSync(CNF_GetRTCSync()); }