Commodore Time
I have a VIC-20. On several occasions I have attempted to tally the amount of computer time utilized via the TI and TI$ functions.
Could you explain first the purpose of TI? Can it be modified manually – set to zero? What does a printout of 1429292 mean? What is its relationship to realtime and TI$?
Secondly, is TI$ supported to count realtime? If so, can you explain why 6 hrs. 31 mins. would show up on TI$ as 063639?
Lastly, is there any way to maintain a cumulative tally on the system of aggregate "on-time"?
D. L. Branam
You can tell Commodore computer's special time variable, TI$, what time it is (or set it to zero so it can keep track of how long the system has been on) by treating it like an ordinary string variable. For example:
TI$ = "033000"
would let the computer know that it was 3:30. This can be done either from within a program or by just typing it in from the keyboard in "direct mode." The string is arranged "HHMMSS" for the positions of hours, minutes, and seconds. It will take anything up to 240000 hours and must include all six numbers, even if a zero is in the first position as in the example above.
You can print out the time in a variety of ways. Here's one:
?LEFT$ (TI$,2) "/" MID$ (TI$,3,2) "/" RIGHTS (TI$,2
or just:
? TI$
TI is the numeric clock variable. It is set to zero when power is first turned on or when you reset the clock: TI$ = "000000". The number in TI is counting time in l/60ths of a second. To see TI:
10 ?"[HOME]" TI: GOTO 10
Six hours 31 minutes should be 063100 when TI$ is printed out.