from datetime import datetime

""" time """


def ts_now():
    return datetime.now().timestamp()


def ts_today():
    now = datetime.now()
    ts_now = now.timestamp()
    return ts_now - now.hour * 60 * 60 - now.minute * 60 - now.second


def str_today(ts):
    dt = datetime.fromtimestamp(ts)
    return dt.strftime('%Y-%m-%d %H:%M:%S')


def str_now():
    return datetime.now().strftime('%Y-%m-%d %H:%M:%S')
