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:
Miroslav Lichvar
2015-03-18 17:48:49 +01:00
parent e5cf4645fe
commit c68a92ba80
3 changed files with 32 additions and 0 deletions

View File

@@ -123,6 +123,28 @@ TMX_SetLeap(int leap)
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)
{
struct timex txc;