def to_epoch(t_str):
    """
    Covert a timestamp string to an epoch number.
    :param str t_str: a timestamp string.
    :return int: epoch number of the timestamp.
    """
    try:
        t = float(t_str)
        return t
    except ValueError:
        for format in constants.TIMESTAMP_STR_FORMATS:
            try:
                t = datetime.datetime.strptime(t_str, format)
                return float(time.mktime(t.utctimetuple()) * 1000.0 + t.microsecond / 1000.0)
            except ValueError:
                pass
    raise exceptions.InvalidDataFormat
def to_epoch ( t_str ) : try : t = float ( t_str ) return t except ValueError : for format in constants . TIMESTAMP_STR_FORMATS : try : t = datetime . datetime . strptime ( t_str , format ) return float ( time . mktime ( t . utctimetuple ( ) ) * 1000.0 + t . microsecond / 1000.0 ) except ValueError : pass raise exceptions . InvalidDataFormat
Covert a timestamp string to an epoch number.
    :param str t_str: a timestamp string.
    :return int: epoch number of the timestamp.