summaryrefslogtreecommitdiff
path: root/apscheduler/job.py
diff options
context:
space:
mode:
authorAlex Grönholm <alex.gronholm@nextday.fi>2014-05-31 14:34:15 +0300
committerAlex Grönholm <alex.gronholm@nextday.fi>2014-05-31 14:34:15 +0300
commit83fa7cba9563f58794098f30b1510c96c43ea4b3 (patch)
treed3beef94ddf29903d151544ddfeca8fc6026c00c /apscheduler/job.py
parent435d0ba09bdf0737f595041223ba74640786270a (diff)
downloadapscheduler-83fa7cba9563f58794098f30b1510c96c43ea4b3.tar.gz
Changed the trigger API to allow it to work with run times in the past
Diffstat (limited to 'apscheduler/job.py')
-rw-r--r--apscheduler/job.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/apscheduler/job.py b/apscheduler/job.py
index b1f8d6e..a65cde6 100644
--- a/apscheduler/job.py
+++ b/apscheduler/job.py
@@ -94,18 +94,17 @@ class Job(object):
def _get_run_times(self, now):
"""
- Computes the scheduled run times between ``next_run_time`` and ``now``.
+ Computes the scheduled run times between ``next_run_time`` and ``now`` (inclusive).
:type now: datetime
:rtype: list[datetime]
"""
run_times = []
- run_time = self.next_run_time
- increment = timedelta(microseconds=1)
- while run_time and run_time <= now:
- run_times.append(run_time)
- run_time = self.trigger.get_next_fire_time(run_time + increment)
+ next_run_time = self.next_run_time
+ while next_run_time and next_run_time <= now:
+ run_times.append(next_run_time)
+ next_run_time = self.trigger.get_next_fire_time(next_run_time, now)
return run_times