SONY driver: Correct fix for timestamp handling (I hope)

This commit is contained in:
Kovid Goyal 2010-06-12 01:45:11 +05:30
parent 6b933e5872
commit 70b2ab0293

View File

@ -12,7 +12,7 @@ from uuid import uuid4
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 @@ class XMLCache(object):
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)