DSTON to check and set DSTON to 0

CAI_Support

Senior Member
We had this DSTON feature since few years ago. Hope anyone depends on clock will have DSTON set to 0 tomorrow morning. Following code will automatically turn off DST for USA daylight saving ending tomorrow morning.
Code:
START   
  # your other logic
  # ....
  TSTEQ CDW 1        # Sunday, first day of the week CurrentDayofWeek == 1
  CALLSUB CKDST      # true, then check if we need to do anything
  NOP   
END   
  
CKDST:
  TSTNE CH 2         # 2am?
  RET                # don't do anything if not true
  TSTEQ CMONTH 3     # March?
  CALLSUB CKDSTON    # then SET DSTON
  TSTEQ CMONTH 11    # November?
  SET DSTON 0        # turn DSTON off, clock will go back for a hour
  NOP
RET   

CKDSTON:        
  TSTGT CDAY 7       # Greater than first Sunday?
  SET DSTON 1        # turn on DSTON on, clock will go back for a hour
  NOP
RET
 
Back
Top