Skip to content

Commit a4b3bc9

Browse files
committed
SnapShooter: Use UTC time instead of local.
1 parent 2b84577 commit a4b3bc9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dp3/snapshots/snapshooter.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def register_run_finalize_hook(self, hook: Callable[[], list[DataPointTask]]):
228228

229229
def make_snapshots(self):
230230
"""Creates snapshots for all entities currently active in database."""
231-
time = datetime.now()
231+
time = datetime.utcnow()
232232
self.db.save_metadata(
233233
time,
234234
{
@@ -258,7 +258,7 @@ def make_snapshots(self):
258258
counts = {"entities": 0, "components": 0}
259259
try:
260260
linked_entities = self.get_linked_entities(time, cached)
261-
times["components_loaded"] = datetime.now()
261+
times["components_loaded"] = datetime.utcnow()
262262

263263
for i, linked_entities_component in enumerate(linked_entities):
264264
counts["entities"] += len(linked_entities_component)
@@ -278,7 +278,7 @@ def make_snapshots(self):
278278
except pymongo.errors.CursorNotFound as err:
279279
self.log.exception(err)
280280
finally:
281-
times["task_creation_end"] = datetime.now()
281+
times["task_creation_end"] = datetime.utcnow()
282282
self.db.update_metadata(
283283
time,
284284
metadata=times,

0 commit comments

Comments
 (0)