start = stop = thetime = now() / 3600 stop_orig = stop if (stop < start) : stop = stop + 24 if thetime <= stop_orig : thetime = thetime + 24 if (thetime >= start) and (thetime < stop) : print 'true' else : print 'false'