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

[tor-commits] [bridgedb/develop] Fix a bug in bridgedb.schedule which caused months >= 13.



commit d2f9498e6d0cfda6a9452ebe1efcf8b6b8eeb606
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Fri Dec 5 23:48:51 2014 +0000

    Fix a bug in bridgedb.schedule which caused months >= 13.
---
 lib/bridgedb/schedule.py |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bridgedb/schedule.py b/lib/bridgedb/schedule.py
index 930f2e7..71b4254 100644
--- a/lib/bridgedb/schedule.py
+++ b/lib/bridgedb/schedule.py
@@ -260,8 +260,12 @@ class ScheduledInterval(Unscheduled):
 
         if self.intervalPeriod == 'month':
             date = fromUnixSeconds(seconds)
+            year = date.year
             months = date.month + self.intervalCount
-            return toUnixSeconds((date.year, months, 1, 0, 0, 0))
+            if months > 12:
+                year = date.year + 1
+                months = months - 12
+            return toUnixSeconds((year, months, 1, 0, 0, 0))
         elif self.intervalPeriod == 'day':
             return seconds + (86400 * self.intervalCount)
         elif self.intervalPeriod == 'hour':



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