import datetime
from time import sleep
start = datetime.datetime.now()
sleep(3)
stop = datetime.datetime.now()
elapsed = stop - start
if elapsed > datetime.timedelta(minutes=1):
    print('Slept for > 1 minute')
if elapsed > datetime.timedelta(seconds=1):
    pass
Comparing a time delta in python