mongo::Date_t::toTimeT conversion bug.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Trivial - P5
    • None
    • Affects Version/s: 2.4.4
    • Component/s: Internal Client
    • None
    • ALL
    • None
    • 3
    • None
    • 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:
              Andy Schwerin
              Reporter:
              Sergey Volkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: