Unix time the day before a leap second seems incorrect
- Dominant language
- Python
- Stars
- 5.3k
- Forks
- 2.2k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 74
Description
### Description
```python
t0 = Time('1978-12-31T23:59:59', format='isot', scale='utc')
t0.to_value('unix')
```
returns 283996798.0000231 instead of 283996799
in general it seems that all unix time stamp the day before a leap second are one second off.
### Expected behavior
unix epoch of '1978-12-31T23:59:59' should be 283996799
### How to Reproduce
```python
from astropy.time import Time
t0 = Time('1978-12-31T23:59:59', format='isot', scale='utc')
t0.to_value('unix')
```
### Versions
Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.31
Python 3.12.6 (main, Sep 10 2024, 00:05:17) [GCC 9.4.0]
astropy 6.1.4
Numpy 2.1.1
pyerfa 2.0.1.4
Scipy not installed
Matplotlib not installed
Contributor guide
Research direction
Start by running the supplied reproduction and trace Time.to_value('unix') through the UTC conversion path. Use the reported 1978-12-31T23:59:59 case as the regression target; done means it returns 283996799 rather than the shown off-by-one value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100