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

[tor-commits] [ooni-probe/master] When we talk about time ALWAYS use UTC



commit 46027a39a768efa6beabac9af62765970762f6bf
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Tue Sep 13 13:21:36 2016 +0200

    When we talk about time ALWAYS use UTC
---
 ooni/agent/scheduler.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ooni/agent/scheduler.py b/ooni/agent/scheduler.py
index 0a6cc0f..d6fbc31 100644
--- a/ooni/agent/scheduler.py
+++ b/ooni/agent/scheduler.py
@@ -50,11 +50,13 @@ class FileSystemlockAndMutex(object):
 
 # We use this date to indicate that the scheduled task has never run.
 # Easter egg, try to see what is special about this date :)?
-CANARY_DATE = datetime(1957, 8, 4)
+CANARY_DATE = datetime(1957, 8, 4, tzinfo=tz.tzutc())
+
 
 class DidNotRun(Exception):
     pass
 
+
 class ScheduledTask(object):
     _time_format = "%Y-%m-%dT%H:%M:%SZ"
     schedule = None
@@ -80,7 +82,7 @@ class ScheduledTask(object):
 
     @property
     def should_run(self):
-        current_time = datetime.utcnow()
+        current_time = datetime.utcnow().replace(tzinfo=tz.tzutc())
         next_cycle = croniter(self.schedule, self.last_run).get_next(datetime)
         if next_cycle <= current_time:
             return True



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