MCPcopy
hub / github.com/hyperopt/hyperopt / coarse_utcnow

Function coarse_utcnow

hyperopt/utils.py:197–207  ·  view source on GitHub ↗

# 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

()

Source from the content-addressed store, hash-verified

195
196
197def 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

Callers 10

_begin_trial_runMethod · 0.90
_write_result_backMethod · 0.90
_write_exception_backMethod · 0.90
refreshMethod · 0.85
fminMethod · 0.85
call_domainFunction · 0.85
serial_evaluateMethod · 0.85
reserveMethod · 0.85
refreshMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected