mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-07 14:35:07 -05:00
Leap second support
Leap second status is accepted and forwarded to clients if majority of selectable sources agree. The actual insertion/deletion is supported only on Linux now.
This commit is contained in:
@@ -39,6 +39,9 @@
|
||||
#include "chrony_timex.h"
|
||||
#include "wrap_adjtimex.h"
|
||||
|
||||
/* Save leap status between calls */
|
||||
static int leap_status = 0;
|
||||
|
||||
int
|
||||
TMX_SetTick(long tick)
|
||||
{
|
||||
@@ -73,6 +76,7 @@ TMX_SetFrequency(double freq, long tick)
|
||||
txc.tick = tick;
|
||||
txc.status = STA_UNSYNC; /* Prevent any of the FLL/PLL stuff coming
|
||||
up */
|
||||
txc.status |= leap_status; /* Preserve leap bits */
|
||||
|
||||
return adjtimex(&txc);
|
||||
}
|
||||
@@ -144,5 +148,24 @@ TMX_ReadCurrentParams(struct tmx_params *params)
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
TMX_SetLeap(int leap)
|
||||
{
|
||||
struct timex txc;
|
||||
|
||||
if (leap > 0) {
|
||||
leap_status = STA_INS;
|
||||
} else if (leap < 0) {
|
||||
leap_status = STA_DEL;
|
||||
} else {
|
||||
leap_status = 0;
|
||||
}
|
||||
|
||||
txc.modes = ADJ_STATUS;
|
||||
txc.status = STA_UNSYNC | leap_status;
|
||||
|
||||
return adjtimex(&txc);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user