from datetime import time
S=time(6,0);E=time(23,0)
def in_window(t,s=S,e=E):
    if s<=e: return s<=t<=e
    return t>=s or t<=e
def minutes_until(t,e=E):
    m=t.hour*60+t.minute; end=e.hour*60+e.minute
    if end<m: end+=24*60
    return end-m
assert in_window(time(10,0)) and not in_window(time(3,0))
assert in_window(time(23,0)) and not in_window(time(5,59))
assert minutes_until(time(22,0))==60
print("SELF-TEST PASS")