-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
DOC: Thoroughly document datetime issues #2858
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
Conversation
After understanding the issues with datetime (see numpygh-568), I have documented my understanding as comments in the code, so that the next time there are problems with datetime on some platform, one can quickly figure out what is going on from the code + comments.
Note: I have removed the words "HACK" from the comments, because it is not a hack. In fact, I think it's the only way to make |
This is clear, thanks for tracking down the issue. These time functions are quite a mess. I guess there are platforms where 64-bit time functions aren't available? Otherwise always using 64-bit seems easier. |
On Thu, Dec 27, 2012 at 2:14 PM, Ralf Gommers [email protected]:
On Linux, gcc time_t is a long, so 32 bits on 32 bit systems. Seems like an Chuck |
I think the fix is generally to use the same approach as numpy --- use the more sophisticated datastructure that can handle any date, and then only use localtime between 1970-2038. On Windows, even with 64 bits, it still can't handle dates before 1970, so one would need to use a workaround anyway. So I'll merge this issue now. |
@@ -34,8 +40,35 @@ | |||
/* | |||
* Wraps `localtime` functionality for multiple platforms. This | |||
* converts a time value to a time structure in the local timezone. | |||
* If size(NPY_TIME_T) == 4, then years must be between 1970 and 2038. If | |||
* size(NPY_TIME_T) == 8, then years must be later than 1970. If the years are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
64 bit linux allow negative time, it seems it is windows where it is unsigned. That's not to say the comment is incorrect for the code ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see the following text clarifies this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If you know a better formulation, let me know.
Excellent notes, they describe the problem very clearly. |
Multiline comments should begin with a blank line. This patch fixes it.
DOC: Thoroughly document datetime issues
Looks good, merged. |
Thanks! |
Backported in #2861. |
After understanding the issues with datetime (see gh-568), I have documented my
understanding as comments in the code, so that the next time there are problems
with datetime on some platform, one can quickly figure out what is going on
from the code + comments.