[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



commit 3ec1a8e6658c3766a3dad15000416569428fa17b
Author: juga0 <juga@xxxxxxxxxx>
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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits