python time range validator
I have 2 parameters in DB: start and stop. value for them can be eg 07:00-23:00 or 23:00-07:00 (start after 07, stop after 23 or start after 23, stop after 07) In that time, a status must be 0 or 1, let's say it's LED How to create unified logic controller that won't mess up after/before midnight? My poor implementation (wont work) is below. Actually, I've tried many-many variations and still ended up where I currently am.. if curtime >= vv_time_trig1 and curtime <= vv_time_trig2: logger.info("turning socket on") logger.debug("#1") #check current status #if current is 0 #turn socket on if