mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
The exception raised by datetime when converting epochs has changed
This commit is contained in:
parent
7e72349b5f
commit
0cecc77a22
@ -248,12 +248,12 @@ def utcnow():
|
|||||||
def utcfromtimestamp(stamp):
|
def utcfromtimestamp(stamp):
|
||||||
try:
|
try:
|
||||||
return datetime.utcfromtimestamp(stamp).replace(tzinfo=_utc_tz)
|
return datetime.utcfromtimestamp(stamp).replace(tzinfo=_utc_tz)
|
||||||
except ValueError:
|
except Exception:
|
||||||
# Raised if stamp is out of range for the platforms gmtime function
|
# Raised if stamp is out of range for the platforms gmtime function
|
||||||
# For example, this happens with negative values on windows
|
# For example, this happens with negative values on windows
|
||||||
try:
|
try:
|
||||||
return EPOCH + timedelta(seconds=stamp)
|
return EPOCH + timedelta(seconds=stamp)
|
||||||
except (ValueError, OverflowError):
|
except Exception:
|
||||||
# datetime can only represent years between 1 and 9999
|
# datetime can only represent years between 1 and 9999
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user