diff --git a/tests/dns_tests/test_service_statistics.py b/tests/dns_tests/test_service_statistics.py index 0088fcd6..0d09a368 100644 --- a/tests/dns_tests/test_service_statistics.py +++ b/tests/dns_tests/test_service_statistics.py @@ -50,7 +50,9 @@ async def test_queries_leave_no_per_profile_document(self, user, mongo_db): settings: no document references the profile; service_statistics gains anonymous, PoP-labelled hourly counters in a single document.""" pid = user.new_profile("service-stats") - hour_start = _utc(time.time() - time.time() % HOUR_S) + # One clock read: two reads straddle a sub-microsecond gap and round below the hour. + now = time.time() + hour_start = _utc(now - now % HOUR_S) since = hour_start baseline = _service_total_since(mongo_db, since)