utils.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:django-anymail 作者: anymail 项目源码 文件源码
def timestamp(dt):
    """Return the unix timestamp (seconds past the epoch) for datetime dt"""
    # This is the equivalent of Python 3.3's datetime.timestamp
    try:
        return dt.timestamp()
    except AttributeError:
        if dt.tzinfo is None:
            return mktime(dt.timetuple())
        else:
            return (dt - EPOCH).total_seconds()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号