save local timezone to conf

saves the user needing to visit AnkiWeb when their timezone has changed
This commit is contained in:
Damien Elmes 2019-12-12 11:30:01 +11:00
parent a735ed19ae
commit 4bc33e2f19

View file

@ -30,7 +30,6 @@ import anki.notes
import anki.template
import anki.find
defaultConf = {
# review options
'activeDecks': [1],
@ -50,6 +49,12 @@ defaultConf = {
'schedVer': 2,
}
def timezoneOffset():
if time.localtime().tm_isdst:
return time.altzone//60
else:
return time.timezone//60
# this is initialized by storage.Collection
class _Collection:
@ -73,6 +78,7 @@ class _Collection:
d = datetime.datetime(d.year, d.month, d.day)
d += datetime.timedelta(hours=4)
self.crt = int(time.mktime(d.timetuple()))
self.conf['localOffset'] = timezoneOffset()
self._loadScheduler()
if not self.conf.get("newBury", False):
self.conf['newBury'] = True