%%HP: T(3);
DIR

  CDP       @ Clock Data Put
\<< \-> V L \<< 'CLKDAT' L V PUT \>> \>>

  CDG       @ Clock Data Get
\<< 'CLKDAT' SWAP GET \>>

  PA        @ PreAmble
\<< RCLF 64 STWS 2 CDG TICKS 1 CDG - OVER - B\->R \>>

  AO        @ Alarm Object
\<< IFERR DROP PATH :&: JOB RCL EVAL EVAL THEN ERRM END OFF \>>

  RESET     @ Reset Reference Time
\<< TICKS 1 CDP 0 2 CDP \>>

  CLKDAT    @ Clock Data
{ #0 0 0 }

  CANCEL    @ Cancel Alarm
\<< RCLF -55 SF IFERR 1 \-> I \<< WHILE I RCLALARM IF 3 GET 'AO'
RCL SAME THEN I DELALARM 1 ELSE 'I' INCR END REPEAT END \>> THEN
END STOF \>>

  SCHEDULE           @ Schedule Alarm
\<< CANCEL PATH HOME IF :&: JOB VTYPE 0 < THEN DUP 'KICK' +
:&: JOB STO END EVAL DATE 1 DATE+ 4 'AO' RCL 707788800 4 \->LIST
STOALARM DROP \>>

  EXACT     @ Compute Accuracy Factor
\<< PA / 3 CDP STOF \>>

  ADJC      @ Adjust Clock
\<< DUP 2 CDG + 2 CDP CLKADJ \>>

  ADJT      @ Adjust Time
\<< 1_s CONVERT UVAL 8192 * DUP 1 CDG + 1 CDP CLKADJ \>>

  KICK      @ Kick Clock
\<< PA 3 CDG * 0 RND SWAP - ADJC STOF \>>

END
