How to set the time on your Commodore C64 / C128

- by

Commodore LogoDid 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.

Add your voice!

This site uses Akismet to reduce spam. Learn how your comment data is processed.