-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: 1.9.0
-
Component/s: None
-
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.