diff --git a/src/keri/app/signaling.py b/src/keri/app/signaling.py index f32e9dbe..fa44c18f 100644 --- a/src/keri/app/signaling.py +++ b/src/keri/app/signaling.py @@ -27,7 +27,7 @@ def signal(attrs, topic, ckey=None, dt=None): Notice: Notice instance """ - dt = dt if dt is not None else datetime.datetime.now().isoformat() + dt = dt if dt is not None else helping.nowIso8601() if hasattr(dt, "isoformat"): dt = dt.isoformat() @@ -117,7 +117,7 @@ def push(self, attrs, topic, ckey=None, dt=None): Returns: """ - dt = dt if dt is not None else datetime.datetime.now() + dt = dt if dt is not None else helping.nowIso8601() sig = signal(attrs=attrs, topic=topic, ckey=ckey, dt=dt) if sig.ckey is not None: @@ -146,7 +146,7 @@ def expireDo(self, tymth=None, tock=0.0): _ = (yield self.tock) while True: # loop checking for expired messages - now = datetime.datetime.now() + now = helping.nowUTC() toRemove = [] for sig in self.signals: if now - helping.fromIso8601(sig.dt) > self.SignalTimeout: # Expire messages that are too old diff --git a/tests/app/test_notifying.py b/tests/app/test_notifying.py index 2f3d294d..a62bb620 100644 --- a/tests/app/test_notifying.py +++ b/tests/app/test_notifying.py @@ -203,7 +203,7 @@ def test_notifier(mockHelpingNowUTC): assert notifier.rem(note.rid) is True assert notifier.getNotes() == [] - dt = datetime.datetime.now() + dt = helping.nowIso8601() assert notifier.add(attrs=dict(a=1)) is True assert notifier.add(attrs=dict(a=2)) is True assert notifier.add(attrs=dict(a=3)) is True diff --git a/tests/app/test_signaling.py b/tests/app/test_signaling.py index 9010d9e8..fb8f8558 100644 --- a/tests/app/test_signaling.py +++ b/tests/app/test_signaling.py @@ -79,7 +79,7 @@ def test_signaler(): signaler.push(attrs=dict(a=1), topic="/m") signaler.push(attrs=dict(a=2), topic="/m", ckey="abc") signaler.push(attrs=dict(a=3), topic="/m") - now = datetime.datetime.now() - datetime.timedelta(minutes=11) + now = helping.nowUTC() - datetime.timedelta(minutes=11) signaler.push(attrs=dict(a=4), topic="/m", ckey="abc", dt=now) assert len(signaler.signals) == 3