Create timer_tool.py

This commit is contained in:
PSBigBig 2025-08-14 19:22:40 +08:00 committed by GitHub
parent 58bfec11d1
commit 49ce59a3d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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")