mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 20:45:07 -05:00
sys: add new log message for kernel status reset after leap second
When a leap second is applied by the kernel, it doesn't actually clear the STA_INS|STA_DEL bits from the status word, but the state returned by ntp_adjtime()/adjtimex() is TIME_WAIT until the application clears the bits. Add "System clock status reset after leap second" log message for this case.
This commit is contained in:
@@ -124,24 +124,25 @@ TMX_SetLeap(int leap)
|
||||
}
|
||||
|
||||
int
|
||||
TMX_GetLeap(int *leap)
|
||||
TMX_GetLeap(int *leap, int *applied)
|
||||
{
|
||||
struct timex txc;
|
||||
int state;
|
||||
|
||||
txc.modes = 0;
|
||||
if (adjtimex(&txc) < 0)
|
||||
state = adjtimex(&txc);
|
||||
if (state < 0)
|
||||
return -1;
|
||||
|
||||
status &= ~(STA_INS | STA_DEL);
|
||||
status |= txc.status & (STA_INS | STA_DEL);
|
||||
|
||||
if (status & STA_INS)
|
||||
if (txc.status & STA_INS)
|
||||
*leap = 1;
|
||||
else if (status & STA_DEL)
|
||||
else if (txc.status & STA_DEL)
|
||||
*leap = -1;
|
||||
else
|
||||
*leap = 0;
|
||||
|
||||
*applied = state == TIME_WAIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user