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
Bug in UTCDateTime #805
Comments
I can't reproduce, @jsaul are you running a 32-bit or embedded platform? Looks like the problem is your version of python has a (obspy-dev)chase:~/Code/python/obspy % uname -srvpo [git|master]
Linux 3.11.0-15-generic #25-Ubuntu SMP Thu Jan 30 17:22:01 UTC 2014 x86_64 GNU/Linux (obspy-dev)chase:~/Code/python/obspy % python [git|0.9.2]
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from obspy.core import UTCDateTime
>>> t = UTCDateTime("2599-05-23T22:35:30")
>>> print t
2599-05-23T22:35:30.000000Z
>>> t.timestamp
19861713330.0
>>> |
Good point, I can reproduce that the error doesn't occur on a 64-bit platform, so it's clearly as you say the Year 2038 problem. The timestamp is correct on the 32-bit platform, so it's mostly a formatting issue. In my client code it can be handled by something like
but it would of course be nice to have a generic solution. I'll have a closer look at this. |
We've already seen some manifestations of this issue in the past. It happens on some (not all if I am not mistaken) 32 bit platforms as already noted. https://github.com/obspy/obspy/blob/master/obspy/core/utcdatetime.py#L505-506 This is used every time a string representation or single components of a datetime like the year, month, ... are requested. It might be possible to change the offending line and use If performance is an issue we can use try/except and fall back to the slower solution if needed. @jsaul: Can you test these solutions? None of my installations has this issue. |
Not the prettiest workaround, but it does work on 32-bit now, thanks! |
we actually did already use the fixed in master - closing |
Conflicts: obspy/core/tests/test_utcdatetime.py obspy/core/utcdatetime.py
This looks like a bug to me. I found this when working with FDSN StationXML produced by IRIS, where end times (e.g. of a sensor operation period) in the future are often expressed using times very far in the future (commonly end of year 2599), so this is not an esoteric example.
ObsPy version is 0.9.2
The text was updated successfully, but these errors were encountered: