How to update leap seconds
이전 댓글 표시
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
Walter Roberson
2023년 9월 15일
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
채택된 답변
추가 답변 (1개)
the cyclist
2023년 9월 15일
0 개 추천
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
Walter Roberson
2023년 9월 15일
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
2023년 9월 15일
편집: James Tursa
2023년 9월 15일
카테고리
도움말 센터 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!