mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
add sanity limits to cutoff calculation
This commit is contained in:
parent
4a35dbe6b2
commit
274017036a
1 changed files with 5 additions and 1 deletions
|
@ -389,7 +389,11 @@ end)""" + where)
|
|||
newday = self.utcOffset - time.timezone
|
||||
d += datetime.timedelta(seconds=newday)
|
||||
self.dueCutoff = time.mktime(d.timetuple())
|
||||
assert self.dueCutoff > time.time()
|
||||
# cutoff must not be in the past
|
||||
while self.dueCutoff < time.time():
|
||||
self.dueCutoff += 86400
|
||||
# cutoff must not be more than 24 hours in the future
|
||||
self.dueCutoff = min(time.time() + 86400, self.dueCutoff)
|
||||
else:
|
||||
self.dueCutoff = time.time()
|
||||
|
||||
|
|
Loading…
Reference in a new issue