[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/develop] Fix bug in b.s.ScheduledInterval.intervalStart().
commit 83e84d10079a6d4ca8513d470f045519ea6e145e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
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)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits