• Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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):

            Assignee:
            mike Michael Dirolf
            Reporter:
            cwb Carl Baatz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: