How to update leap seconds
8 ビュー (過去 30 日間)
古いコメントを表示
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
採用された回答
Peter Perkins
2023 年 9 月 19 日
James, there's no way for customers to update MATLAB with new leap seconds. The IERS data is built into a binary file.
The last leap second was 31-Dec-2016. R2016b came out a bit before that, but was "frozen" before the IERS declared that leap second in July 2016. I can't recall if we posted a patch, but if 16b is the version that matters, I can look to see if there's a patch. I know that many of our large customers validate a particular release and standardize on that for years at a time.
These days, we would incorporate a new leap second via MATLAB Updates. That process began sometime around R2018b, I forget exactly when. But in any case, 18b would have that most recent leap second, and no new ones have been declared, and it's anyone's guess whether or not any new ones will ever be declared (this was my guess).
Walter: "datetime() has more leap-second handling than I expected" Is there any leap-second handling that you were looking for that's not there?
5 件のコメント
Steven Lord
2023 年 9 月 21 日
What was the first version of MATLAB that uses MATLAB Updates?
I believe release R2015a SP1 was the first release that had an Update release, based on selecting "I WANT TO: Get Updates" on the downloads page.
Searching the Support site for "leap second" and filtering to only show Bug Reports lists three bug reports:
- Bug Report 1191139
- The Bug Report I linked previously, 1448069
- Bug Report 1192415
That last links to another Bug Report (1196109) related to datetime arrays that doesn't specifically include the term "leap second".
I'm not sure of the answers to your other questions.
その他の回答 (1 件)
the cyclist
2023 年 9 月 15 日
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.
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!