[tor-commits] [bridgedb/develop] Fix bug in b.s.ScheduledInterval.intervalStart().
isis at torproject.org
isis at torproject.org
Tue Mar 31 11:55:46 UTC 2015
commit 83e84d10079a6d4ca8513d470f045519ea6e145e
Author: Isis Lovecruft <isis at torproject.org>
Date: Tue Mar 31 10:38:05 2015 +0000
Fix bug in b.s.ScheduledInterval.intervalStart().
* FIXES a bug exposed by the test committed in 9edb6956.
* CHANGES b.s.ScheduledInterval.intervalStart() to convert any
timestamps which are passd into it to integers.
---
lib/bridgedb/schedule.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/bridgedb/schedule.py b/lib/bridgedb/schedule.py
index 659380f..0adbff8 100644
--- a/lib/bridgedb/schedule.py
+++ b/lib/bridgedb/schedule.py
@@ -12,6 +12,8 @@
import calendar
+import math
+
from datetime import datetime
from zope import interface
@@ -237,6 +239,9 @@ class ScheduledInterval(Unscheduled):
:returns: The Unix epoch timestamp for the start time of the interval
that contains **when**.
"""
+ # Convert `when`s which are floats, i.e. from time.time(), to ints:
+ when = int(math.ceil(when))
+
if self.intervalPeriod == 'month':
# For months, we always start at the beginning of the month.
date = fromUnixSeconds(when)
More information about the tor-commits
mailing list