How to update leap seconds
Mostrar comentarios más antiguos
The current version of MATLAB has a function to give you the leap second information that it is using. E.g.,
[T,vers] = leapseconds
But suppose you have a version of MATLAB that is not up to date with the latest leap second data. E.g., an older version of MATLAB, or maybe a recent version of MATLAB but there is a leap second announced that your version doesn't know about. I know there is a proposal to abolish leap seconds (programmers in multiple s/w packages never could seem to get this coded correctly), but what if there is another leap second announced before they officially become abolished or you have an older version of MATLAB? This link doesn't mention how to update MATLAB for this:
Is there a way for the user to update their version of MATLAB by downloading new files or updating current files or ...?
2 comentarios
Walter Roberson
el 15 de Sept. de 2023
It looks like it is getting the information from https://www.iers.org/IERS/EN/Publications/Bulletins/bulletins.html
My suspicion is that when each version of MATLAB is built, that the xml files are pre-processed into a resource that is built-in. The individual files do not have enough information for the entire table, and I cannot find a copy of the .xml files anywhere in R2023b
James Tursa
el 15 de Sept. de 2023
Editada: James Tursa
el 15 de Sept. de 2023
Respuesta aceptada
Más respuestas (1)
the cyclist
el 15 de Sept. de 2023
0 votos
The file leapseconds.m calls a built-in file to get the list of leap seconds, but you can edit that file to add additional ones.
In fact, that file contains (commented-out) instructions on how to add leap seconds by "brute force".
2 comentarios
Walter Roberson
el 15 de Sept. de 2023
The commented-out instructions are for determining the list of leap seconds based upon what datetime() returns -- which implies that datetime() has been configured to already know the leapsecond rules.
datetime() has more leap-second handling than I expected, but in most places it is not clear to me what is taking care of determining leap seconds. I do see it calls upon matlab.internal.datetime.addLeapSeconds and matlab.internal.datetime.removeLeapSeconds which can tell you whether the time was within a leap second or not... but those are compiled in.
James Tursa
el 15 de Sept. de 2023
Editada: James Tursa
el 15 de Sept. de 2023
Categorías
Más información sobre Dates and Time en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!