Fix #762543 (add .txt when book is created)

This commit is contained in:
Kovid Goyal 2011-04-16 07:48:22 -06:00
parent 3bb24273f3
commit d80584abb2

View File

@ -130,7 +130,14 @@ def utcnow():
return datetime.utcnow().replace(tzinfo=_utc_tz)
def utcfromtimestamp(stamp):
try:
return datetime.utcfromtimestamp(stamp).replace(tzinfo=_utc_tz)
except ValueError:
# Raised if stamp if out of range for the platforms gmtime function
# We print the error for debugging, but otherwise ignore it
import traceback
traceback.print_exc()
return utcnow()
def format_date(dt, format, assume_utc=False, as_utc=False):
''' Return a date formatted as a string using a subset of Qt's formatting codes '''