def _to_timestamp(date):
try:
return (date - EPOCH).total_seconds()
except AttributeError:
# The following is the equivalent of total_seconds() in Python2.6.
# See also: https://docs.python.org/2/library/datetime.html
delta = date - EPOCH
return ((delta.microseconds + (delta.seconds + delta.days * 24 * 3600)
* 10**6) / 10**6)
评论列表
文章目录