mirror of
https://github.com/ankitects/anki.git
synced 2025-11-14 00:27:13 -05:00
save local timezone to conf
saves the user needing to visit AnkiWeb when their timezone has changed
This commit is contained in:
parent
a735ed19ae
commit
4bc33e2f19
1 changed files with 7 additions and 1 deletions
|
|
@ -30,7 +30,6 @@ import anki.notes
|
||||||
import anki.template
|
import anki.template
|
||||||
import anki.find
|
import anki.find
|
||||||
|
|
||||||
|
|
||||||
defaultConf = {
|
defaultConf = {
|
||||||
# review options
|
# review options
|
||||||
'activeDecks': [1],
|
'activeDecks': [1],
|
||||||
|
|
@ -50,6 +49,12 @@ defaultConf = {
|
||||||
'schedVer': 2,
|
'schedVer': 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def timezoneOffset():
|
||||||
|
if time.localtime().tm_isdst:
|
||||||
|
return time.altzone//60
|
||||||
|
else:
|
||||||
|
return time.timezone//60
|
||||||
|
|
||||||
# this is initialized by storage.Collection
|
# this is initialized by storage.Collection
|
||||||
class _Collection:
|
class _Collection:
|
||||||
|
|
||||||
|
|
@ -73,6 +78,7 @@ class _Collection:
|
||||||
d = datetime.datetime(d.year, d.month, d.day)
|
d = datetime.datetime(d.year, d.month, d.day)
|
||||||
d += datetime.timedelta(hours=4)
|
d += datetime.timedelta(hours=4)
|
||||||
self.crt = int(time.mktime(d.timetuple()))
|
self.crt = int(time.mktime(d.timetuple()))
|
||||||
|
self.conf['localOffset'] = timezoneOffset()
|
||||||
self._loadScheduler()
|
self._loadScheduler()
|
||||||
if not self.conf.get("newBury", False):
|
if not self.conf.get("newBury", False):
|
||||||
self.conf['newBury'] = True
|
self.conf['newBury'] = True
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue