C+ C NAME: C TimeOut C PURPOSE: C Pause program execution for specified number of seconds C CALLING SEQUENCE: subroutine TimeOut(ns,nd) C INPUTS: C ns integer time-out period (seconds) C nd integer time (in seconds) interval that C a check is made whether time ns has C elapsed (i.e. process sleeps for C nd seconds at a time). C If nd<0 the process sleeps for ns sec. C OUTPUTS: C Display on screen if nd > 0 only C CALLS: C Time2System, sleep C RESTRICTIONS: C > Uses 1H+ to write to screen. Probably does not work on C every terminal. C > Currently uses function 'sleep' to go to sleep for nd C seconds at at time. On VMS this will not work (should use C lib$wait instead). C MODIFICATION HISTORY: C JUL-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer ns integer nd integer t(2) integer TimeLapsed integer Time2Units in_sec = Time2Units()/86400 ! # fract units per second if (nd .gt. 0 .and. in_sec .gt. 0) then write (*,'(//,10X,20(1H*),A,20(1H*),//,24X,A,I7)') ' TimeOut ','Seconds to go >>',ns call Time2System(t) in_sec = Time2Units()/86400 ! # fract units per second i = ns do while (i .gt. 0) call sleep(nd) !j = i !do while (i .lt. j+nd) !i = TimeLapsed(t)/in_sec !end do i = ns-TimeLapsed(t)/in_sec write (*,'(1H+,23X,A,I10)') 'Seconds to go >>',i end do write (*,'(//)') else call sleep(ns) end if return end