Calculate number of seconds from UTC 1970-01-01 00:00:00.

    When:

    - dt doesn't have tzinfo: assume it's a utc time.
    - dt has tzinfo: use tzinfo.

    WARNING, if your datetime object doens't have ``tzinfo``, make sure
    it's a UTC time, but **NOT a LOCAL TIME**.

    **中文文档**

    计算时间戳, 若:

    - 不带tzinfo: 则默认为是UTC time。
    - 带tzinfo: 则使用tzinfo。

def to_utctimestamp(a_datetime):
    """
    Calculate number of seconds from UTC 1970-01-01 00:00:00.

    When:

    - dt doesn't have tzinfo: assume it's a utc time.
    - dt has tzinfo: use tzinfo.

    WARNING, if your datetime object doens't have ``tzinfo``, make sure
    it's a UTC time, but **NOT a LOCAL TIME**.

    **中文文档**

    计算时间戳, 若:

    - 不带tzinfo: 则默认为是UTC time。
    - 带tzinfo: 则使用tzinfo。
    """
    if a_datetime.tzinfo is None:
        delta = a_datetime - datetime(1970, 1, 1)
    else:
        delta = a_datetime - datetime(1970, 1, 1, tzinfo=utc)
    return delta.total_seconds()