Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-10102

mongo::Date_t::toTimeT conversion bug.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • None
    • Affects Version/s: 2.4.4
    • Component/s: Internal Client
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      unsigned long long is not best suitable to store date/time values because its may be negative.

      Or cast it correctly anywhere.
      file misc.h:99

      return millis / 1000;

      this makes unsigned division and return incorrect time_t for negative ( less than '1970-01-01' )

      must be:
      return static_cast<long long>( millis ) / 1000;

      Thanks.

            Assignee:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            lis82 Sergey Volkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: