mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:24:49 +02:00
SONY driver: Correct fix for timestamp handling (I hope)
This commit is contained in:
parent
6b933e5872
commit
70b2ab0293
1 changed files with 2 additions and 8 deletions
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
from lxml import etree
|
||||
|
||||
from calibre import prints, guess_type, iswindows, islinux
|
||||
from calibre import prints, guess_type
|
||||
from calibre.devices.errors import DeviceError
|
||||
from calibre.devices.usbms.driver import debug_print
|
||||
from calibre.constants import DEBUG
|
||||
|
|
@ -47,10 +47,7 @@ def strptime(src):
|
|||
src[2] = str(MONTH_MAP[src[2]])
|
||||
return time.strptime(' '.join(src), '%w, %d %m %Y %H:%M:%S %Z')
|
||||
|
||||
def strftime(epoch, zone=None):
|
||||
zone = time.gmtime
|
||||
if islinux:
|
||||
zone = time.localtime
|
||||
def strftime(epoch, zone=time.localtime):
|
||||
src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split()
|
||||
src[0] = INVERSE_DAY_MAP[int(src[0][:-1])]+','
|
||||
src[2] = INVERSE_MONTH_MAP[int(src[2])]
|
||||
|
|
@ -427,9 +424,6 @@ def create_text_record(self, root, bl_id, lpath):
|
|||
|
||||
def update_text_record(self, record, book, path, bl_index):
|
||||
timestamp = os.path.getmtime(path)
|
||||
# Correct for MS DST time 'adjustment'
|
||||
if iswindows and time.daylight:
|
||||
timestamp -= time.altzone - time.timezone
|
||||
date = strftime(timestamp)
|
||||
if date != record.get('date', None):
|
||||
record.set('date', date)
|
||||
|
|
|
|||
Loading…
Reference in a new issue