[tor-commits] [sbws/maint-1.1] fix: timestamp: measurements period is in seconds

juga at torproject.org juga at torproject.org
Mon Mar 9 18:00:44 UTC 2020


commit 3ec1a8e6658c3766a3dad15000416569428fa17b
Author: juga0 <juga at riseup.net>
Date:   Tue Mar 3 18:31:41 2020 +0000

    fix: timestamp: measurements period is in seconds
    
    by default days is passed to timedelta, what was making the oldest
    date be thousands of days in the past.
---
 sbws/util/timestamp.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbws/util/timestamp.py b/sbws/util/timestamp.py
index ee0755a..075e82b 100644
--- a/sbws/util/timestamp.py
+++ b/sbws/util/timestamp.py
@@ -90,5 +90,5 @@ def is_old(timestamp, measurements_period=MEASUREMENTS_PERIOD):
             # This will raise an exception if the type is not int or float or
             # is not actually a timestamp
             timestamp = unixts_to_dt_obj(timestamp)
-    oldest_date = datetime.utcnow() - timedelta(measurements_period)
+    oldest_date = datetime.utcnow() - timedelta(seconds=measurements_period)
     return timestamp < oldest_date





More information about the tor-commits mailing list