Repository navigation
Change epoch of TimeUnixTAI to 1970-01-01T00:00:00.0 TAI, fixes #11245 - #11249
Conversation
|
As @taldcroft mentioned in #11245, #11143 is slated for 4.3 and not yet released. However, you requested this to be milestoned to 4.2.x, so what other PR is this reverting that was released in 4.2; Can you please clarify? Thanks! |
mhvk
left a comment
There was a problem hiding this comment.
Looks good, thanks! One thing to add is a quick change for the epoch for unix_tai listed in docs/time/index.rst (in "Time from epoch formats"; I hope I caught everything...)
|
Oops, failure is real too: the format list in one of the docstrings needs to be adjusted. |
TL;DRThis is a bug fix for a feature introduced in 4.2 which makes an already merged feature planned for 4.3 obsolete. Summarizing the discussions in #11245 and #11143 the situation and how we got here is as follows:
We now realized, that the proper epoch for |
|
Then this fix will be nothing more than changing '1970-01-01 00:00:08' to '1970-01-01 00:00:00' in the right places and fixing tests. |
|
Doing it this way makes backporting this change possible, at least if I understand things. |
|
Yes I agree, will rebase. |
|
Done, this now only contains the changes to |
|
See #11251. |
|
@pllim I misread the changelog. |
| class TimeUnix(TimeFromEpoch): | ||
| """ | ||
| Unix time: seconds from 1970-01-01 00:00:00 UTC, ignoring leap seconds. | ||
| Unix time (UTC): seconds from 1970-01-01 00:00:00 UTC, subject to leap seconds. |
There was a problem hiding this comment.
The words subject to are ambiguous. Please leave this as it was originally.
There was a problem hiding this comment.
Ignoring is just wrong. UTC is the only timescale that has leap seconds. Subject to may be ambiguous, but it is rightly so because it confers to the reader that it is not as simple as "ignoring" and that one needs to understand what is actually happening.
There was a problem hiding this comment.
In this context "ignoring leap seconds" is equivalent to the definition of unix time which is computing the seconds since the epoch assuming exactly 86400 seconds in every day. The actual unix time on a computer is as simple as ignoring, no?
The value of Unix time on a computer is related to the UTC time name components (year, yday, hour, min, sec) according to the expression:
tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86 400 + (tm_year-70)*31 536 000 + ((tm_year-69)/4*86 400
|
|
||
| For example, 946684800.0 in Unix time is midnight on January 1, 2000. | ||
|
|
||
| In unix time, each UTC day always has exactly 86400 seconds, even on |
There was a problem hiding this comment.
Please keep PR's in scope. I think that the new content is actually confusing the situation because of the mix here between POSIX unix time and astropy unix_time. In particular with the new text, the meaning of "NOTE: this quantity .." becomes ambiguous. I think the original paragraph is sufficient, so please just revert these new paragraphs.
| and the linux CLOCK_TAI (https://www.cl.cam.ac.uk/~mgk25/posix-clocks.html). | ||
|
|
||
| For more information on this time format definition, see: | ||
| https://www-acc.gsi.de/wiki/Timing/TimingSystemButisInterface#Time |
There was a problem hiding this comment.
I'm not sure this link is relevant in this context. The "time format definition" from the typical user perspective is quite simple and stated clearly in the first line. The link provides a lot of information on a complex protocol which uses TAI, but I didn't learn anything more about the time format definition.
There was a problem hiding this comment.
This was copied from the PTP docs that were introduced and now reverted. Since the two formats are now the same I thought it should be merged.
There was a problem hiding this comment.
I was thinking of PTP as the format introduced in the context of these physics libraries you reference, and unix_tai as the one for most astronomers. On re-reviewing this as a change to the unix_tai docs it just seems out of place and not a generally useful link for most users of the format.
| >>> jyear = np.linspace(2000, 2001, 20) | ||
| >>> t = Time(jyear, format='jyear', scale='utc') | ||
| >>> plt.plot_date(t.plot_date, jyear) | ||
| >>> plt.plot_date(t.plot_date, jyear) # doctest: +IGNORE_OUTPUT |
There was a problem hiding this comment.
because plot_date returns a Line object which lead to a doctest failure.
There was a problem hiding this comment.
That makes sense, but makes me wonder why it was passing tests before. Did something else change in the meantime that made this doctest line suddenly start failing?
There was a problem hiding this comment.
@maxnoe - did this fail for you locally or in the CI tests? (good to change regardless, but also good to understand indeed why this did not trigger problems before!)
There was a problem hiding this comment.
It failed locally, did not check the CI, I fixed this together with other test failures so I don't know whether this also affected CI or whether something with my local setup was strange. Can change back to check.
There was a problem hiding this comment.
Actually, right now we instruct the test to be skipped:
astropy/astropy/time/formats.py
Line 35 in ef40111
If with you IGNORE_OUTPUT, this works, perhaps we can change it to a matplotlib requirement?
__doctest_requires__ = {'TimePlotDate': ['matplotlib']}
(Though if you prefer to just leave things as they were, that's fine too!)
There was a problem hiding this comment.
I think this is best for another PR, will revert the change here.
1784555 to
0d886ca
Compare
|
@taldcroft I removed most of the docs changes and will open another PR about that. We should get this fixed, so I don't want to discuss about leap second wordings here. |
…py#11245 * TimeUnixTAI (name unix_tai) used the epoch ``1970-01-01T00:00:00 UTC`` since its introduction in astropy 4.1, however, contrary to the documented behaviour, this is not the definition of CLOCK_TAI on linux and no system using this epoch is known. * This switches the epoch to ``1970-01-01T00:00:00.0 TAI`` to match the intended defintion of being compatible to CLOCK_TAI on linux and also is the definition of the now obselete and already removed ``TimeUnixPTP``, which was thus never part of a realeased version of astropy.
|
ci/circleci: image-tests-mpldev failure looks unrelated so merging this. |
Change epoch of TimeUnixTAI to 1970-01-01T00:00:00.0 TAI, fixes #11245
TimeUnixTAI (name unix_tai) used the epoch
1970-01-01T00:00:00 UTCsince its introduction in astropy 4.2, however, contrary to the
documented behaviour, this is not the definition of CLOCK_TAI on linux
and no system using this epoch is known.
This switches the epoch to
1970-01-01T00:00:00.0 TAIto match theintended defintion of being compatible to CLOCK_TAI on linux and also
is the definition of the now obselete and not yet released
TimeUnixPTP, which is removed in this commit.Fixes #11245