def T(t, step=30):
    if hasattr(t, 'timestamp'):
        timestamp = t.timestamp()
    else:
        # python 2
        if t.tzinfo is None:
            timestamp = time.mktime(t.timetuple())
        else:
            utc_naive  = t.replace(tzinfo=None) - t.utcoffset()
            timestamp = (utc_naive - datetime.datetime(1970, 1, 1)).total_seconds()

    return int(timestamp) // step
The TOTP T value (number of time steps since the epoch)
dataset/ETHPy150Open gavinwahl/django-u2f/django_u2f/oath.py/T