CADS_COLE@GALLUA.BITNET ("Kevin Cole at Gallaudet U. Washington DC") (04/19/88)
Michael Fetzer <FETZER@NMFECC.ARPA> submitted a clock program a few weeks back.
After looking at it a bit, I decided to comment it and post it for the less
enlightened among us (a group of which I am frequently a member). Also, to
crank the thing up, try:
$ SPAWN/NOWAIT RUN CLOCK
The following is Michael's original message followed by a slightly modified and
commented version of his program:
"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."
--------------------------------- <cut here> ----------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! !
! *** CLOCK *** Written by Michael Fetzer !
! Modified by Kevin Cole 04/12/88 !
! !
! This program is meant to be spawned in a subprocess. The cursor !
! position and attributes are saved, the video is set to reverse-dim, !
! and the cursor is moved by direct address command to the appropriate !
! screen location to print the date and time. Then the video is set !
! back to normal and the cursor position and attributes are restored. !
! !
! The magic command is: $ SPAWN/NOWAIT RUN CLOCK (KJC) !
! !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PROGRAM CLOCK
CHARACTER DAT*9, TIM*8
CHARACTER ESC*1, SCROLL*7, HILITE*6, NORMAL*4, LOCATE*8
INTEGER ITIME(2)
ITIME(1)= -15E7
ITIME(2)= -1
ESC = CHAR(27)
SCROLL = ESC//'[0;23r' ! Set scrolling region to first 23 lines
SAVE = ESC//'7' ! Save current cursor attributes
HILITE = ESC//'[1;7m' ! Turn on reverse video
LOCATE = ESC//'[24;63H' ! Move cursor to lower right corner
NORMAL = ESC//'[0m' ! Turn off reverse video
RECALL = ESC//'8' ! Restore former cursor attributes
TYPE 10,SCROLL
10 FORMAT ('+',A7,$)
20 CALL DATE(DAT) ! Get current date as a string
CALL TIME(TIM) ! Get current time as a string
TYPE 30,SAVE,HILITE,LOCATE,DAT,TIM,NORMAL,RECALL
30 FORMAT ('+',A2,A6,A8,A9,1X,A8,A4,A2,$)
CALL SYS$SCHDWK (,,ITIME,)
CALL SYS$HIBER ! Sleep for ITIME seconds
GOTO 20
END
--------------------------------------------------------------------------------
Kevin Cole <Flatline> BITNET: KJCOLE@GALLUA.BITNET
Center for Assessment and or
Demographic Studies (CADS) CADS_COLE@GALLUA.BITNET
Gallaudet Research Institute (GRI) UUCP: ...!psuvax!gallua.bitnet!kjcole
Gallaudet University CompuServe: 76167,1406
Washington, D.C. 20002
(202) 651-5575
"Hey Rocky! Watch me pull a rabbit out of my hat!"
-------