unless second option is activated, second is set 0 in every iteration

This commit is contained in:
taichino 2010-01-25 05:46:30 +09:00
parent 456aa30d2f
commit 5f26f88bfd
2 changed files with 5 additions and 3 deletions

View File

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
"""
croniter provides iteration for datetime object with cron like format.
Simple example of usage is followings
>>> from croniter import croniter
@ -21,18 +19,20 @@
All you need to know is constructor and get_next, these signature are following.
>>> def __init__(self, cron_format, start_time=time.time())
croniter iterate along with 'cron_format' from 'start_time'.
cron_format is 'min hour day month day_of_week', and please refer to
http://en.wikipedia.org/wiki/Cron for details.
>>> def get_next(self, ret_type=float)
get_next return next time in iteration with 'ret_type'.
And ret_type accept only 'float' or 'datetime'.
"""
__author__ = "Matsumoto Taichi (taichino@gmail.com)"
__version__ = "0.1.1"
__version__ = "0.1.3"
__license__ = "MIT License"
from croniter import croniter

View File

@ -142,6 +142,8 @@ class croniter:
if diff_sec > 0:
dst += relativedelta(seconds = diff_sec)
continue
else:
dst += relativedelta(second = 0)
return time.mktime(dst.timetuple())
raise "failed to find next date"