Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4050

GridFS Bucket File Save stores incorrect uploadDate

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.19.0
    • Affects Version/s: 1.9.0
    • Component/s: None
    • Labels:
      None
    • Minor Change

      The gridfs_bucket_file_save API is setting uploadDate to the value returned from bson_monotonic_time(), which is incorrect in two ways:

      • bson_append_datetime expects time as milliseconds since the epoch, whereas the monotonic time is returned in microseconds. This is fixed by a simple division (but loses precision).
      • bson_monotonic_time() on POSIX returns the CLOCK_REALTIME clock value, which is relative to "an unspecified point in the past." Which may be the epoch, but can be arbitrary. On my system (and several systems in CI), the return value is relative to the system uptime. This results in an uploadDate only a few hours/days after 1970.

            Assignee:
            colby.pike@mongodb.com Colby Pike
            Reporter:
            colby.pike@mongodb.com Colby Pike
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: