Did you know that the Commodore computers had a built-in clock? It wasn’t an exact science, and it didn’t show the date, but it was able to display a 24hr clock.
It did this by counting how many seconds your machine was switched on, accessible in two variables TI and TI$ (short for TIME).
TI$ is a string value in the format HHMMss, counting seconds. 112347 would mean 11:23am and 47 seconds. TI$ will be 000000 when you switch on the system. You can set it just like any other variable to set the time:
TI$ = "094500"
TI counts the number of 60th seconds since the system was switched on (don’t ask):
print int(ti/60);" seconds since startup"
Both values reset when you reset the system. Like all internal computer clocks it is relatively accurate, but does drift a second or two per day (we don’t notice this on modern systems because those talk to an NTP server once every day and sync themselves).
TI and TI$ are present on the C64, C128, Plus/4 and many other Commodore variants.