-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:32-bit operating systems
For dates after 19 January 2038, 32-bit system integers representing the date (as seconds since 1 January 1970) overflow. Both Python and MongoDB internally handle this correctly, but PyMongo uses the integer representation (specifically the C type time_t) to convert between the two and that produces errors on 32-bit systems. This is not an issue on systems that have a larger time_t type (most if not all 64-bit systems for example).
There are issues with both _cbsonmodule.c and bson.py.
bson.py:
datetime.datetime.utcfromtimestamp() internally uses time_t so can't convert large dates in MongoDB into Python on 32-bit systems. Not sure what the workaround here is (using time.gmtime() does not work). Converting to Mongo works because calendar.timegm returns a long if necessary.
_cbsonmodule.c (my C skills are rusty to say the least so I may well have this wrong):
- Replace the time_t type and related conversion methods to handle epochs > 32-bits. Perhaps something like http://code.google.com/p/y2038/ can help?