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

Make Date_t::toString handle dates before 1970

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Date_t::toString calls this function in src/mongo/bson/util/misc.h:

              time_t toTimeT() const {
                  // cant use uassert from bson/util
                  verify((long long)millis >= 0); // TODO when millis is signed, delete 
                  verify(((long long)millis/1000) < (std::numeric_limits<time_t>::max)());
                  return millis / 1000;
              }

      As an example of where this problem can come up, if we call BSONElement::jsonString with pretty printing on a BSON object that has a date before 1970, we'll hit this verify.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              schwerin Andy Schwerin
              Reporter:
              sverch Shaun Verch
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: