Okay guys,
Anyone know what's going on here?
Regards,
Shaun.
The BASIC TIME$ variable
-
- Member
- Posts: 12
- Joined: Sat Feb 12, 2022 2:00 pm
- Contact:
Re: The BASIC TIME$ variable
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.
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.
Socialism never took root in America because the poor see themselves not as an exploited proletariat but as temporarily embarrassed millionaires. -John Steinbeck
-
- Member
- Posts: 12
- Joined: Sat Feb 12, 2022 2:00 pm
- Contact:
Re: The BASIC TIME$ variable
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.
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.
- Zippy Zapp
- Member
- Posts: 206
- Joined: Tue Jul 21, 2015 6:52 pm
- Location: USA
- Contact:
Re: The BASIC TIME$ variable
IIRC, you only get an Illegal Quantity Error if you set it to less than 6 digits/characters. IE: TI$="12345"
Commodore - Changing the world 8 bits at a time.
Who is online
Users browsing this forum: No registered users and 1 guest