timer command?

65 views
Skip to first unread message

Sherrina Clark

unread,
Oct 16, 2026, 11:43:15 AMOct 16
to tinspire
Is there a command to use that can measure how long a program runs and for that measurement to print on the screen? (in general)

I am timing student projects of a music light show and their criteria is minimum 10 seconds maximum 30 seconds. I would like to run the program and have a timer start and stop to determine how long their song is.

Sherrina Clark


Bert W

unread,
Oct 16, 2026, 2:15:11 PMOct 16
to tins...@googlegroups.com
This is a simple stopwatch.
Perhaps this is what you are looking for?

Bert Wikkerink


Stopwatch.tns

John Hanna

unread,
Oct 16, 2026, 7:43:24 PMOct 16
to tins...@googlegroups.com
Did not get the original post.
How about this?
Regards,
    John 


From: tins...@googlegroups.com <tins...@googlegroups.com> on behalf of Bert W <b.wik...@gmail.com>
Sent: Friday, October 16, 2026 2:14 PM
To: tins...@googlegroups.com <tins...@googlegroups.com>
Subject: Re: [tinspire] timer command?
 
This is a simple stopwatch.
Perhaps this is what you are looking for?

Bert Wikkerink


--
--
To post to this group, send email to tins...@googlegroups.com
Unsubscribe by sending an email to tinspire+u...@googlegroups.com
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/tns-files
---
You received this message because you are subscribed to the Google Groups "tinspire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinspire+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/tinspire/3526EE2C-FCB7-4C66-A5F6-3F7903D25B31%40gmail.com.
Stopwatch-Wikkerink-H.tns

John Hanna

unread,
Oct 16, 2026, 7:57:36 PMOct 16
to tinspire
Basic (no)
Python (yes) see Bert's

Sherrina Clark

unread,
Oct 19, 2026, 11:50:23 AMOct 19
to tinspire
Can you send the code without the file? My district is blocking this download...:(

thanks!

Bert W

unread,
Oct 19, 2026, 11:58:24 AMOct 19
to tins...@googlegroups.com
Yes I can.
See below.


from ti_system import *
clear_history()
print()
print("Press a key to start")
get_key(1)
a = get_time_ms()
print("Press a key to stop")
get_key(1)
b = get_time_ms()
print("Time: ",(b-a)/1000,"seconds”)




-- 
-- 
To post to this group, send email to tins...@googlegroups.com
Unsubscribe by sending an email to tinspire+u...@googlegroups.com
The tns documents shared by group members are archived at 
https://sites.google.com/site/tinspiregroup/tns-files
--- 
You received this message because you are subscribed to the Google Groups "tinspire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tinspire+u...@googlegroups.com.

Sherrina Clark

unread,
Oct 19, 2026, 12:10:30 PMOct 19
to tinspire
thanks!

What can I change so that the timer is running while the program is running?

Bert W

unread,
Oct 19, 2026, 12:30:21 PMOct 19
to tins...@googlegroups.com
This is a simple Python-based stopwatch program.
When you start it, it will ask you to press a key to start the timer.
As soon as you hit a key again, the timer stops and shows you the total time in seconds.
If you want to try it again, just rerun the program.





Debo

unread,
Oct 19, 2026, 6:12:29 PMOct 19
to tinspire
Hi Sherrina,

Here is a variant of Bert's program.  Imagine that the for-loop in the middle is the student's music program.  Students will have to add the System module import to their program.  Add the "a" variable for get_time_ms() at the beginning of their program.  The "b" variable at the end.  Then the print() statement to do the math and print the time.

from ti_system import *
from time import *
a=get_time_ms()
for i in range(10):
  sleep(.5)
b=get_time_ms()

print("Time: ",(b-a)/1000,"seconds")

timecheckPrgm.jpg  timecheckShell.jpg
These screens came from running it on the computer software (which interestingly shows a few milliseconds longer than on running on the handheld).

John Hanna

unread,
Oct 19, 2026, 9:20:22 PMOct 19
to tinspire
I think she want the timer showing wile the code is executing: add a statement in the program loop to display the timer value.

Regards,
    John 


From: tins...@googlegroups.com <tins...@googlegroups.com> on behalf of Debo <steve....@gmail.com>
Sent: Monday, October 19, 2026 6:12 PM
To: tinspire <tins...@googlegroups.com>

Subject: Re: [tinspire] timer command?
Reply all
Reply to author
Forward
0 new messages