Second Sixty on an Ordinary Day
Second Sixty on an Ordinary Day
A counterparty sends the FIX timestamp 20171231-23:59:60. A shape check allows a second of 60, so the message goes through. What does the system store?
The naive approach
// The naive approach: a pattern that allows 60, then Temporal
const fix = "20171231-23:59:60";
/^\d{8}-\d{2}:\d{2}:[0-6]\d$/.test(fix);
// true — well-formed
Temporal.Instant.from("2017-12-31T23:59:60Z").toString();
// "2017-12-31T23:59:59Z" — a second that never happened, stored as a real oneWatch it break
The naive approach silently produces wrong results — there is no GMT equivalent to demonstrate because the failure is not using GMT.
Why
FIX allows a second of 60 only for a UTC leap second, and UTC has inserted 27, the last at the end of 2016. The pattern checks the spelling and cannot say whether the second exists, and Temporal clamps any 60 to 59 without a word. So a stamp from a day with no leap second becomes the second before it, and a real leap second is lost the same way. `parseFixUtcTimestamp` looks the day up in the leap-second table: it returns `null` for 2017-12-31, and for 2016-12-31 it reads the inserted second and flags it.
The gmt approach
import { parseFixUtcTimestamp } from "@northguild/gmt/finance/parse";
parseFixUtcTimestamp("20171231-23:59:60");
// null — no leap second was inserted that day
parseFixUtcTimestamp("20161231-23:59:60");
// { instant: "2016-12-31T23:59:60Z", precision: "second", leapSecond: true, picoseconds: 0 }Same widget, working
In the widget, change the year to 2016 and the stamp is read as the inserted second. Any other
year with the same month and day returns null. A boolean check is
isValidFixUtcTimestamp, and the rules
are in Finance: Message
Timestamps. The same lesson for a
log line in ISO form is A Leap Second That Never
Happened.
© 2026 NorthGuild · Licences
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.