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");
}
}
int
-TMX_GetLeap(int *leap, int *applied)
+TMX_GetLeapApplied(int *applied)
{
struct timex txc;
int state;
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;
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);