diff --git a/src/calibre/devices/prs505/sony_cache.py b/src/calibre/devices/prs505/sony_cache.py index 46ccf1f3d2..a444c9e5e2 100644 --- a/src/calibre/devices/prs505/sony_cache.py +++ b/src/calibre/devices/prs505/sony_cache.py @@ -46,7 +46,11 @@ def strptime(src): return time.strptime(' '.join(src), '%w, %d %m %Y %H:%M:%S %Z') def strftime(epoch, zone=time.localtime): - src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split() + try: + src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone(epoch)).split() + except: + src = time.strftime("%w, %d %m %Y %H:%M:%S GMT", zone()).split() + src[0] = INVERSE_DAY_MAP[int(src[0][:-1])]+',' src[2] = INVERSE_MONTH_MAP[int(src[2])] return ' '.join(src)