mirror of
https://github.com/onestardao/WFGY.git
synced 2026-05-01 21:11:11 +00:00
Create timer_tool.py
This commit is contained in:
parent
58bfec11d1
commit
49ce59a3d2
1 changed files with 15 additions and 0 deletions
15
ProblemMap/mvp_demo/instruments/timer_tool.py
Normal file
15
ProblemMap/mvp_demo/instruments/timer_tool.py
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import time
|
||||||
|
|
||||||
|
class Timer:
|
||||||
|
def __init__(self):
|
||||||
|
self.start_time = None
|
||||||
|
|
||||||
|
def start(self):
|
||||||
|
self.start_time = time.time()
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
if self.start_time is None:
|
||||||
|
print("Timer was not started.")
|
||||||
|
return
|
||||||
|
elapsed = time.time() - self.start_time
|
||||||
|
print(f"Elapsed time: {elapsed:.4f} seconds")
|
||||||
Loading…
Add table
Add a link
Reference in a new issue