Is it possible to count time while program is running? I wanted to add screen with score and how long it toke to beat the game, but I don't know how to do this.
Time counting, pls help
Started by
Satoshi
, Nov 19 2017 11:07 AM
2 replies to this topic
#1
Posted 19 November 2017 - 11:07 AM
#2
Posted 03 December 2017 - 11:27 AM
Hi Satoshi
Casio Basic does not have timer commands.
So if you do not need to measure exact time, just using loop with incremental variable may help;
0->C
Do
Getkey->K
Isz C
[some process]
LpWhile K≠[keucode of key that you want to get out of this loop with]
then use C to refer count of loop.
Good luck!
Edited by Krtyski, 03 December 2017 - 11:28 AM.
#3
Posted 21 June 2019 - 12:40 AM
In short, no, not accurately.
Time calculations are created based upon loop routines.
Each line of code consumes time and therefore creates a speed bump in the loop which needs a comparator to rectify it.
Another issue is battery voltage. As voltage decreases the program slows down resulting in longer calculation cycles.
Thermal variation also plays havoc with calculation speed and is a known factor in computer performance. The warmer the device the slower the calculation.
The closest approximation is a program I wrote as a countdown timer based upon real world timings over extended periods.
ClrText
"Countdown timer duration in seconds"?->A
7.18A->A
For 1->B To A Step 0.01
Next
ClrText
Locate 7,4,"Time up!"
Time calculations are created based upon loop routines.
Each line of code consumes time and therefore creates a speed bump in the loop which needs a comparator to rectify it.
Another issue is battery voltage. As voltage decreases the program slows down resulting in longer calculation cycles.
Thermal variation also plays havoc with calculation speed and is a known factor in computer performance. The warmer the device the slower the calculation.
The closest approximation is a program I wrote as a countdown timer based upon real world timings over extended periods.
ClrText
"Countdown timer duration in seconds"?->A
7.18A->A
For 1->B To A Step 0.01
Next
ClrText
Locate 7,4,"Time up!"
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users