Fix time reception during minute with leap second

This commit is contained in:
Jeff Epler 2022-01-10 20:20:07 -06:00
parent a4e875b7e3
commit fbb3c67bd6
No known key found for this signature in database
GPG key ID: D5BF15AB975AB4DE

View file

@ -240,7 +240,12 @@ void try_decode() {
if (snapshot.symbols.at(snapshot.SYMBOLS - 1) == 2) {
if (snapshot.decode_minute(w)) {
tick_subsec = mod_diff<snapshot.SUBSEC>(snapshot.sos, 5);
w.advance_minutes();
// Must advance by seconds instead of by a minute, because
// if this just-received minute has a leap second,
// advancing 1 minute leaves us at the wrong moment, because we're
// at just 60 seconds into the minute. (23:59:60 instead of
// 00:00:00 next day)
w.advance_seconds(60);
ever_set = true;
display_time();
}