ONScreen clock

 BBS: Inland Empire Archive
Date: 05-01-92 (12:32)             Number: 186
From: JOHN GALLAS                  Refer#: NONE
  To: TIM FITZGERALD                Recvd: NO  
Subj: ONScreen clock                 Conf: (2) Quik_Bas
TF>  Hello all!,
TF>
TF>          I've ran into yet another "mind boggling" situation..
TF>          I need to display a clock on the screen that is active at ALL
TF>          times. I won't be displaying the seconds, just the hour and

    Hmm..  I saw something like that in the old GWBASIC
manual.  <it is modified for QB>  Just do this in the
beginning of your program:
ON TIMER(60) GOSUB PrintTime
TIMER ON

.
.
.

PrintTime:
D=CSRLIN
A=POS(0)

LOCATE 1,1:PRINT LEFT$(TIME$,5);

LOCATE D,S
RETURN


And that will update the clock every 60 seconds.  If you
don't want the time displayed in military time, then use
this:

FUNCTION RealTime$
a = VAL(LEFT$(TIME$, 2))
IF a < 12 THEN ampm$ = "am"
IF a = 0 THEN ampm$ = "pm"
IF a > 11 THEN ampm$ = "pm"

IF a > 12 THEN tim$ = JStr$(a - 12)
IF a < 13 THEN tim$ = JStr$(a)
IF a = 0 THEN tim$ = "12"
tim$ = tim$ + MID$(TIME$, 3, 3)
tim$ = tim$ + ampm$
RealTime$ = tim$
END FUNCTION

And instead of PRINT LEFT$(TIME$,5); you'd do PRINT RealTime$;, and that
would have the correct time plus a am/pm sign.

--- ProBoard v1.21 [Reg]
 * Origin: The O-Zone BBS  612/591-7767  New Hope, MN (1:282/30.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET