From 6b581edb55420ac9917a730a635f0ff3dbefd37b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Barth Date: Wed, 18 Nov 2015 22:02:58 +0100 Subject: [PATCH] Use datetime.utcnow() instead of datetime.now() (suggested in @spulec review) --- moto/swf/models/activity_task.py | 2 +- moto/swf/models/decision_task.py | 2 +- moto/swf/utils.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/moto/swf/models/activity_task.py b/moto/swf/models/activity_task.py index eef8350e2..1a72d3449 100644 --- a/moto/swf/models/activity_task.py +++ b/moto/swf/models/activity_task.py @@ -25,7 +25,7 @@ class ActivityTask(object): self.workflow_execution = workflow_execution # this is *not* necessarily coherent with workflow execution history, # but that shouldn't be a problem for tests - self.scheduled_at = datetime.now() + self.scheduled_at = datetime.utcnow() def _check_workflow_execution_open(self): if not self.workflow_execution.open: diff --git a/moto/swf/models/decision_task.py b/moto/swf/models/decision_task.py index 5474332a5..b76888403 100644 --- a/moto/swf/models/decision_task.py +++ b/moto/swf/models/decision_task.py @@ -21,7 +21,7 @@ class DecisionTask(object): self.state = "SCHEDULED" # this is *not* necessarily coherent with workflow execution history, # but that shouldn't be a problem for tests - self.scheduled_at = datetime.now() + self.scheduled_at = datetime.utcnow() self.timeout_type = None @property diff --git a/moto/swf/utils.py b/moto/swf/utils.py index 02603bea9..a9c54ee3a 100644 --- a/moto/swf/utils.py +++ b/moto/swf/utils.py @@ -6,4 +6,4 @@ def decapitalize(key): return key[0].lower() + key[1:] def now_timestamp(): - return float(mktime(datetime.now().timetuple())) + return float(mktime(datetime.utcnow().timetuple()))