mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
reference: check for unset leap_when in is_leap_close()
Check that the leap_when variable is set before testing a timestamp for being close to a leap second. This allows the first measurement to be accepted if starting at the Unix epoch (e.g. in a test).
This commit is contained in:
@@ -1333,7 +1333,8 @@ REF_DisableLocal(void)
|
|||||||
static int
|
static int
|
||||||
is_leap_close(time_t t)
|
is_leap_close(time_t t)
|
||||||
{
|
{
|
||||||
return t >= leap_when - LEAP_SECOND_CLOSE && t < leap_when + LEAP_SECOND_CLOSE;
|
return leap_when != 0 &&
|
||||||
|
t >= leap_when - LEAP_SECOND_CLOSE && t < leap_when + LEAP_SECOND_CLOSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|||||||
Reference in New Issue
Block a user