mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 13:15:06 -05:00
sys: avoid syslog message when leap bits are not changed
After leap second the kernel removes STA_INS and STA_DEL bits from the adjtimex status automatically, don't report a change when clearing the bits.
This commit is contained in:
@@ -174,6 +174,15 @@ read_frequency(void)
|
|||||||
static void
|
static void
|
||||||
set_leap(int leap)
|
set_leap(int leap)
|
||||||
{
|
{
|
||||||
|
int current_leap;
|
||||||
|
|
||||||
|
if (TMX_GetLeap(¤t_leap) < 0) {
|
||||||
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current_leap == leap)
|
||||||
|
return;
|
||||||
|
|
||||||
if (TMX_SetLeap(leap) < 0) {
|
if (TMX_SetLeap(leap) < 0) {
|
||||||
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap");
|
LOG_FATAL(LOGF_SysLinux, "adjtimex() failed in set_leap");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,28 @@ TMX_SetLeap(int leap)
|
|||||||
return adjtimex(&txc);
|
return adjtimex(&txc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
TMX_GetLeap(int *leap)
|
||||||
|
{
|
||||||
|
struct timex txc;
|
||||||
|
|
||||||
|
txc.modes = 0;
|
||||||
|
if (adjtimex(&txc) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
status &= ~(STA_INS | STA_DEL);
|
||||||
|
status |= txc.status & (STA_INS | STA_DEL);
|
||||||
|
|
||||||
|
if (status & STA_INS)
|
||||||
|
*leap = 1;
|
||||||
|
else if (status & STA_DEL)
|
||||||
|
*leap = -1;
|
||||||
|
else
|
||||||
|
*leap = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int TMX_SetSync(int sync, double est_error, double max_error)
|
int TMX_SetSync(int sync, double est_error, double max_error)
|
||||||
{
|
{
|
||||||
struct timex txc;
|
struct timex txc;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ int TMX_ResetOffset(void);
|
|||||||
int TMX_SetFrequency(double *freq, long tick);
|
int TMX_SetFrequency(double *freq, long tick);
|
||||||
int TMX_GetFrequency(double *freq, long *tick);
|
int TMX_GetFrequency(double *freq, long *tick);
|
||||||
int TMX_SetLeap(int leap);
|
int TMX_SetLeap(int leap);
|
||||||
|
int TMX_GetLeap(int *leap);
|
||||||
int TMX_SetSync(int sync, double est_error, double max_error);
|
int TMX_SetSync(int sync, double est_error, double max_error);
|
||||||
int TMX_TestStepOffset(void);
|
int TMX_TestStepOffset(void);
|
||||||
int TMX_ApplyStepOffset(double offset);
|
int TMX_ApplyStepOffset(double offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user