Skip to content

Instantly share code, notes, and snippets.

@Richienb
Created October 10, 2017 02:17
Show Gist options
  • Save Richienb/f1c3d85bc4d0b2addbe8e41c62900b04 to your computer and use it in GitHub Desktop.
Save Richienb/f1c3d85bc4d0b2addbe8e41c62900b04 to your computer and use it in GitHub Desktop.
Simple Python Stopwatch
import time
seconds = 0
minutes = 0
hours = 0
mseconds = 0
while True:
print(hours, ":", minutes, ":", seconds, ":", mseconds)
time.sleep(0.01)
if minutes == 59:
hours += 1
minutes = 0
if seconds == 59:
seconds = 0
minutes += 1
if mseconds == 59:
seconds += 1
mseconds = 0
else:
mseconds += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment