Make Date_t::toString handle dates before 1970

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Andy Schwerin
            Reporter:
            Shaun Verch (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: