Page 1 of 1

The BASIC TIME$ variable

Posted: Sun Feb 13, 2022 5:19 pm
by The_Other_Shaun_B
Okay guys,

Anyone know what's going on here?

Regards,

Shaun.

Re: The BASIC TIME$ variable

Posted: Mon Feb 21, 2022 12:33 am
by eslapion
I do.

TIME$ is the long version of the TI$ variable used in the OS of all Commodore BASIC implementations. Commodore BASIC only consider the first two characters in the name of variables.

When you turn on your PET/VIC-20/C64, TI$ contains "000000" and is incremented by 1 every second. However when 000059 is reached, the next value is 000100 so the content is 2 digits for hours, 2 digits for minutes and 2 digits for seconds.

You can force this variable to an actual time of day value by typing TI$="051719" and the system will keep increasing this clock value accordingly. Inputting letters, however gives unpredictable results.

Re: The BASIC TIME$ variable

Posted: Sat Feb 26, 2022 5:47 pm
by The_Other_Shaun_B
Hi,

Thanks for the explanation. I already knew that TIME$ and TI$ are equivalent, but I just wondered why I could enter any string value without an "illegal quantity error"

Regards,

Shaun.

Re: The BASIC TIME$ variable

Posted: Mon Feb 28, 2022 7:18 pm
by Zippy Zapp
IIRC, you only get an Illegal Quantity Error if you set it to less than 6 digits/characters. IE: TI$="12345"