littlefish/timetool.py
def unix_time(dt=None, as_int=False):
    """Generate a unix style timestamp (in seconds)"""
    if dt is None:
        dt = datetime.datetime.utcnow()

    if type(dt) is datetime.date:
        dt = date_to_datetime(dt)

    epoch = datetime.datetime.utcfromtimestamp(0)
    delta = dt - epoch
    
    if as_int:
        return int(delta.total_seconds())

    return delta.total_seconds()
def unix_time(dt=None, as_int=False):
    """Generate a unix style timestamp (in seconds)"""
    if dt is None:
        dt = datetime.datetime.utcnow()

    if type(dt) is datetime.date:
        dt = date_to_datetime(dt)

    epoch = datetime.datetime.utcfromtimestamp(0)
    delta = dt - epoch
    
    if as_int:
        return int(delta.total_seconds())

    return delta.total_seconds()
def unix_time ( dt = None , as_int = False ) : if dt is None : dt = datetime . datetime . utcnow ( ) if type ( dt ) is datetime . date : dt = date_to_datetime ( dt ) epoch = datetime . datetime . utcfromtimestamp ( 0 ) delta = dt - epoch if as_int : return int ( delta . total_seconds ( ) ) return delta . total_seconds ( )
Generate a unix style timestamp (in seconds)
Generate a unix style timestamp ( in seconds )