This commit is contained in:
Kovid Goyal 2016-06-04 10:38:14 +05:30
parent 5b84dcb722
commit a96d7ac336

View File

@ -14,7 +14,7 @@ from lxml import etree
from lxml.builder import ElementMaker from lxml.builder import ElementMaker
from calibre import force_unicode from calibre import force_unicode
from calibre.utils.date import parse_date, now as nowf, utcnow, tzlocal, \ from calibre.utils.date import parse_date, now as nowf, utcnow, local_tz, \
isoformat, fromordinal isoformat, fromordinal
from calibre.utils.recycle_bin import delete_file from calibre.utils.recycle_bin import delete_file
@ -420,14 +420,14 @@ class SchedulerConfig(object):
return utcnow() - ld > timedelta(sch) return utcnow() - ld > timedelta(sch)
elif typ == 'day/time': elif typ == 'day/time':
now = nowf() now = nowf()
ld_local = ld.astimezone(tzlocal()) ld_local = ld.astimezone(local_tz)
day, hour, minute = sch day, hour, minute = sch
return is_weekday(day, now) and \ return is_weekday(day, now) and \
not was_downloaded_already_today(ld_local, now) and \ not was_downloaded_already_today(ld_local, now) and \
is_time(now, hour, minute) is_time(now, hour, minute)
elif typ == 'days_of_week': elif typ == 'days_of_week':
now = nowf() now = nowf()
ld_local = ld.astimezone(tzlocal()) ld_local = ld.astimezone(local_tz)
days, hour, minute = sch days, hour, minute = sch
have_day = False have_day = False
for day in days: for day in days:
@ -439,7 +439,7 @@ class SchedulerConfig(object):
is_time(now, hour, minute) is_time(now, hour, minute)
elif typ == 'days_of_month': elif typ == 'days_of_month':
now = nowf() now = nowf()
ld_local = ld.astimezone(tzlocal()) ld_local = ld.astimezone(local_tz)
days, hour, minute = sch days, hour, minute = sch
have_day = now.day in days have_day = now.day in days
return have_day and \ return have_day and \