]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Don't print zero seconds printouts
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Sun, 18 Dec 2011 12:13:23 +0000 (14:13 +0200)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Sun, 18 Dec 2011 12:13:23 +0000 (14:13 +0200)
This means that times that are for example exactly 60 seconds are now
just "1 minute" and not "1 minute 0 seconds".

emerge-timer.py

index b88d80eba5247c83725c23aa138f53f1e298a157..af0f255c35c52441342cb49fb8f056fe6aeb9c49 100755 (executable)
@@ -219,11 +219,12 @@ def give_time(time, nocolor=False):
             pminutes = (green_start + str(minutes) +
                         color_stop + " minutes ")
 
-    pseconds = (green_start + str(seconds) +
-                color_stop + " second ")
-    if seconds != 1:
+    if seconds > 0:
         pseconds = (green_start + str(seconds) +
-                    color_stop + " seconds ")
+                    color_stop + " second ")
+        if seconds != 1:
+            pseconds = (green_start + str(seconds) +
+                        color_stop + " seconds ")
 
     if nocolor == True:
         green_start = "\033[32m"