[comp.os.vms] Another FORTRAN CLOCK...

FETZER@NMFECC.ARPA (04/08/88)

Looks like all of a sudden everyone is interested in having a running
clock on the screen.  My solution was to reserve the last line of the screen
for the clock, that way it doesn't interfere with anything.  One problem you
might run into: most screen oriented editors, for example, reset the scrolling
region to the entire screen upon exiting.  I've gotten around that by
writing a dcl procedure to start the editor and take care of the scrolling
after it exits.  One might simply move the line 'print*,esc....'
inside the do loop, though, and have
everything reset each time the clock is updated.  Incidentally, you will
probably want to change how often the clock update occurs, I do it every
15 sec.

Here it is:
        PROGRAM CLOCK
C       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
C       !                                                                    !
C       !                           CLOCK.FOR                                !
C       !                                                                    !
C       !     This program is meant to be spawned in a subprocess.  The      !
C       !  cursor position and attributes are saved, the video is set to     !
C       !  reverse-dim, and the cursor is moved by direct address command    !
C       !  to the appropriate screen location to print the date and time.    !
C       !  Then the video is set back to normal and the cursor position      !
C       !  and attributes are restored.                                      !
C       !                                                                    !
C       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        CHARACTER*9 DAT
        CHARACTER*8 TIM
        CHARACTER*1 ESC
        DIMENSION ITIME(2)
        ITIME(1)=-15E7
        ITIME(2)=-1
        ESC = CHAR(27)
        print*,esc,'[0;23r'
30      CALL DATE(DAT)
        CALL TIME(TIM)
        SEC = SECNDS(0.0)
        print100,esc,'7',esc,'[1;7m',esc,'[24;63H',DAT,' ',
     1       TIM,esc,'[0m',esc,'8'
100     format ('+',A1,A1,A1,A5,A1,A7,A9,A1,A8,A1,A3,A1,A1,$)
        CALL SYS$SCHDWK (,,ITIME,)
        CALL SYS$HIBER
        GOTO 30
        END

 ---------------------------------------------------------------
| Michael Fetzer						|	
|								|
| U. C. S. D.			  T. S. R. Inc.			|
| Dept. of Physics  B-019	  3933 1/2 Riviera Dr.		|
| La Jolla, CA			  San Diego CA  92109		|
| (619) 534-5304		  (619) 270-4965		|
|								|
| Internet:	FETZER@nmfecc.ARPA				|
| MFEnet:	FETZER@ccc.mfenet				|
| BITNET: 	FETZER%ccc.mfenet@SDSC.BITNET			|
| HEPnet:	CSA::"FETZER@ccc.mfenet"			|
 ---------------------------------------------------------------