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

[tor-commits] [guardfraction/master] Always use UTC time, since that's what consensuses use.



commit b79a8861aa00611ebcc5307d03587e2e3e59121b
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Tue Feb 24 14:28:42 2015 +0000

    Always use UTC time, since that's what consensuses use.
---
 guardfraction.py       |    4 ++--
 guardiness/guard_ds.py |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/guardfraction.py b/guardfraction.py
index 81bd3df..b933105 100755
--- a/guardfraction.py
+++ b/guardfraction.py
@@ -129,9 +129,9 @@ def check_clock_correctness(db_cursor):
     latest_date_in_db = db_cursor.fetchone()[0]
     latest_date_in_db = datetime.datetime.strptime(latest_date_in_db, "%Y-%m-%d %H:%M:%S")
 
-    if datetime.datetime.now() < latest_date_in_db:
+    if datetime.datetime.utcnow() < latest_date_in_db:
         raise DesynchronizedClock("Current time is in the past (%s compared to %s)" %
-                                  (datetime.datetime.now(), latest_date_in_db))
+                                  (datetime.datetime.utcnow(), latest_date_in_db))
 
 def main():
     """
diff --git a/guardiness/guard_ds.py b/guardiness/guard_ds.py
index 61907b0..5d9a7d8 100644
--- a/guardiness/guard_ds.py
+++ b/guardiness/guard_ds.py
@@ -60,7 +60,7 @@ class Guards(object):
 
         Might raise IOError.
         """
-        now = datetime.datetime.now() # get the current date
+        now = datetime.datetime.utcnow() # get the current date
         now = now.replace(microsecond=0) # leave out the microsecond part
 
         with open(output_fname, 'w+') as f:

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