Skip to content

Commit

Permalink
Big fix for clock.py
Browse files Browse the repository at this point in the history
A microsecond error causes the script to crash if microseconds == 0. Fix
by Phil, confirmed by Ric
  • Loading branch information
Boeeerb committed Mar 4, 2014
1 parent b527ebf commit d112ac2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 133 deletions.
131 changes: 0 additions & 131 deletions Examples/TESTING-clock.py

This file was deleted.

11 changes: 9 additions & 2 deletions Examples/clock.py
Expand Up @@ -31,8 +31,15 @@
while True:
time = datetime.now().time()
hour,min,sec = str(time).split(":")
sec,micro = str(sec).split(".")


# Bug fix by Phil Moyer - Tested and verified by Ric Woods - Thanks guys!
try:
rv = str(sec).index(".")
sec,micro = str(sec).split(".")
except ValueError:
sec = str(sec)
micro = "0"

hour = int(hour)
if show12hr == 1:
if hour > 12:
Expand Down

0 comments on commit d112ac2

Please sign in to comment.