WAIT: PROCEDURE(IN_SECONDS); /* PROCEDURE CAUSES PROCESS TO HIBERNATE FOR A NUMBER OF SECONDS GIVEN BY THE ARGUMENT. WAIT MUST BE BETWEEN 0 AND 86400 (ONE DAY). AUTHOR: ALAN CUTLER DATE: MARCH 19, 1982 */ %INCLUDE $STSDEF; %INCLUDE SYS$CLREF; %INCLUDE SYS$SETIMR; %INCLUDE SYS$WAITFR; DCL (HOURS,MINUTES,SECONDS,IN_SECONDS) FIXED BINARY(31); DCL ASCII_TIME CHAR(10); DCL (PSEC,PMIN,PHR) PIC'99'; IF IN_SECONDS<0 | IN_SECONDS>86400 THEN DO; PUT EDIT('Seconds argument out of range')(SKIP,A); RETURN; END; SECONDS=MOD(IN_SECONDS,60); MINUTES=DIVIDE(MOD(IN_SECONDS-SECONDS,3600),60,31); HOURS=DIVIDE(IN_SECONDS-SECONDS-(MINUTES*60),3600,31); PSEC=SECONDS; PMIN=MINUTES; PHR=HOURS; ASCII_TIME = '0 '||PHR||':'||PMIN||':'||PSEC; STS$VALUE = SYS$CLREF(5); IF ^STS$SUCCESS THEN RETURN; STS$VALUE = SYS$SETIMR(5,GETBINTIM(ASCII_TIME),,); IF ^STS$SUCCESS THEN RETURN; STS$VALUE = SYS$WAITFR(5); IF ^STS$SUCCESS THEN RETURN; RETURN; GETBINTIM: PROCEDURE(STRING) RETURNS(BIT(64) ALIGNED); %INCLUDE SYS$BINTIM; %INCLUDE $STSDEF; DCL STRING CHAR(*), TIME BIT(64) ALIGNED; STS$VALUE = SYS$BINTIM(STRING,TIME); IF ^STS$SUCCESS THEN TIME=COPY('0'B,64); RETURN(TIME); END GETBINTIM; END WAIT;