utils.now_utc_ms_prec()

Return the current UTC time with microseconds rounded to milliseconds.

Usage

Source

utils.now_utc_ms_prec()

This is useful for producing a datetime that is consistent with MongoDB’s millisecond precision.