[or-cvs] r24074: {arm} Fix from Fabian for decimal seconds from ps. (arm/trunk/src/util)

Damian Johnson atagar1 at gmail.com
Thu Jan 13 03:06:37 UTC 2011


Author: atagar
Date: 2011-01-13 03:06:37 +0000 (Thu, 13 Jan 2011)
New Revision: 24074

Modified:
   arm/trunk/src/util/uiTools.py
Log:
Fix from Fabian for decimal seconds from ps.



Modified: arm/trunk/src/util/uiTools.py
===================================================================
--- arm/trunk/src/util/uiTools.py	2011-01-13 00:05:03 UTC (rev 24073)
+++ arm/trunk/src/util/uiTools.py	2011-01-13 03:06:37 UTC (rev 24074)
@@ -333,7 +333,7 @@
   """
   Provides the number of seconds corresponding to the formatting used for the
   cputime and etime fields of ps:
-  [[dd-]hh:]mm:ss or hh:mm.ss
+  [[dd-]hh:]mm:ss or mm:ss.ss
   
   If the input entry is malformed then this raises a ValueError.
   
@@ -349,14 +349,12 @@
     days = int(timeEntry[:dateDivider])
     timeEntry = timeEntry[dateDivider+1:]
   
-  # normalise the seconds delimiter
-  timeEntry = timeEntry.replace(".", ":")
-  
   timeComp = timeEntry.split(":")
   if len(timeComp) == 3:
     hours, minutes, seconds = timeComp
   elif len(timeComp) == 2:
     minutes, seconds = timeComp
+    seconds = round(float(seconds))
   else:
     raise ValueError(errorMsg)
   



More information about the tor-commits mailing list