# MongoDB stores only to the nearest millisecond # This is mentioned in a footnote here: # http://api.mongodb.org/python/current/api/bson/son.html#dt
()
| 195 | |
| 196 | |
| 197 | def coarse_utcnow(): |
| 198 | """ |
| 199 | # MongoDB stores only to the nearest millisecond |
| 200 | # This is mentioned in a footnote here: |
| 201 | # http://api.mongodb.org/python/current/api/bson/son.html#dt |
| 202 | """ |
| 203 | now = datetime.datetime.utcnow() |
| 204 | microsec = (now.microsecond // 10 ** 3) * (10 ** 3) |
| 205 | return datetime.datetime( |
| 206 | now.year, now.month, now.day, now.hour, now.minute, now.second, microsec |
| 207 | ) |
| 208 | |
| 209 | |
| 210 | @contextmanager |
no outgoing calls
no test coverage detected