Does MATLAB datetime arithmetic ignore inserted leap seconds?
0 reputation · 20 Apr 2024, 07:48 UTC
Goal
I need to know whether MATLAB datetime subtraction across a historical leap second returns the calendar-day difference or the true elapsed SI time, and whether any release-specific flag or function changes this behavior.
Constraints
MATLAB datetime objects use the proleptic Gregorian calendar and define one day as exactly 86,400 seconds. Arithmetic between datetime values or added duration values ignores inserted leap seconds and treats every minute as 60 seconds. This behavior is described as intended design and has been consistent since the datetime datatype was introduced.
Uncertainty
It is unclear whether recent MATLAB releases provide any built-in leap-second table, conversion mode, or release note exception for timestamps spanning a leap second. Applications requiring legal or scientific leap-second accuracy may need external correction after MATLAB arithmetic.
Does MATLAB datetime arithmetic ignore inserted leap seconds across all supported releases, and is there a supported way to enable leap-second-aware subtraction?