[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/master] Using stem to get tor's start time



commit fdee5d0006f89d8dbde47b529f1f2bbda5bfcdf3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue May 28 09:35:11 2013 -0700

    Using stem to get tor's start time
    
    Replacing our custom implementation for getting tor's start time with stem's
    new system.get_start_time() function.
---
 src/util/torTools.py |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/src/util/torTools.py b/src/util/torTools.py
index 1576ede..bb5e6a5 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -1317,23 +1317,10 @@ class Controller:
         self._pathPrefixLogging = False # prevents logging if fetched again
         result = prefixPath
       elif key == "startTime":
-        myPid = self.controller.get_pid(None)
-        
-        if myPid:
-          if proc.is_available():
-            try:
-              result = float(proc.get_stats(myPid, proc.Stat.START_TIME)[0])
-            except: pass
-          
-          if not result:
-            # if we're either not using proc or it fails then try using ps
-            try:
-              psCall = system.call("ps -p %s -o etime" % myPid)
-              
-              if psCall and len(psCall) >= 2:
-                etimeEntry = psCall[1].strip()
-                result = time.time() - str_tools.parse_short_time_label(etimeEntry)
-            except: pass
+        try:
+          result = system.get_start_time(self.controller.get_pid())
+        except:
+          pass
       elif key == "authorities":
         # There's two configuration options that can overwrite the default
         # authorities: DirServer and AlternateDirAuthority.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits