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

Make Date_t::toString handle dates before 1970

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

      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:
            schwerin@mongodb.com Andy Schwerin
            Reporter:
            sverch Shaun Verch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: