Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #6894 on branch 4.1 (Added clarity to docstring for utime format) #6899

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/6894.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added clarifying detail (in the `~sunpy.time.TimeUTime` docstring) for how the ``utime`` time format handles seconds on a day with a leap second.
15 changes: 12 additions & 3 deletions sunpy/time/timeformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ class TimeUTime(TimeFromEpoch):

Notes
-----
This format is very similar to the default output format of the the ``anytim``
routine in SSW. However, there are discrepancies of up to a second on days with
a leap second.
This format "ignores" leap seconds by treating each day as spanned by exactly
86400 seconds, which means that this format's second is not actually uniform in
duration. On a day without a leap second, this format's second is equal to an
SI second. On a day with a leap second, this format's second is larger than an
SI second by 1/86400 of an SI second.

This format is very similar to the default output format of the ``anytim``
routine in SSW in that there are exactly 86400 seconds assigned for each day.
However, ``anytim`` treats the seconds as always equal to an SI second, and thus
the 86400 seconds span only the first 86400/86401 of the day, and the leap
second is skipped over. This results in discrepancies of up to a second on days
with a leap second.

This format is equivalent to `~astropy.time.TimeUnix`, except that the epoch is
9 years later.
Expand Down