diff --git a/sys_linux.c b/sys_linux.c index d1849ca..c315015 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -173,15 +173,13 @@ read_frequency(void) static void set_leap(int leap) { - int current_leap, applied; + int applied; - if (TMX_GetLeap(¤t_leap, &applied) < 0) { + applied = 0; + if (!leap && TMX_GetLeapApplied(&applied) < 0) { LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap"); } - if (current_leap == leap) - return; - if (TMX_SetLeap(leap) < 0) { LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap"); } diff --git a/wrap_adjtimex.c b/wrap_adjtimex.c index ce6f267..b543718 100644 --- a/wrap_adjtimex.c +++ b/wrap_adjtimex.c @@ -124,7 +124,7 @@ TMX_SetLeap(int leap) } int -TMX_GetLeap(int *leap, int *applied) +TMX_GetLeapApplied(int *applied) { struct timex txc; int state; @@ -134,13 +134,6 @@ TMX_GetLeap(int *leap, int *applied) if (state < 0) return -1; - if (txc.status & STA_INS) - *leap = 1; - else if (txc.status & STA_DEL) - *leap = -1; - else - *leap = 0; - *applied = state == TIME_WAIT; return 0; diff --git a/wrap_adjtimex.h b/wrap_adjtimex.h index 217d060..97d4164 100644 --- a/wrap_adjtimex.h +++ b/wrap_adjtimex.h @@ -31,7 +31,7 @@ int TMX_ResetOffset(void); int TMX_SetFrequency(double *freq, long tick); int TMX_GetFrequency(double *freq, long *tick); int TMX_SetLeap(int leap); -int TMX_GetLeap(int *leap, int *applied); +int TMX_GetLeapApplied(int *applied); int TMX_SetSync(int sync, double est_error, double max_error); int TMX_TestStepOffset(void); int TMX_ApplyStepOffset(double offset);