[tor-commits] [arm/release] fix: last tor runtime showed if never connected

atagar at torproject.org atagar at torproject.org
Sun Jul 17 06:08:30 UTC 2011


commit c2b4bd61b78b2b5fcda639c0f791f998223955ff
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Jul 3 18:13:22 2011 -0700

    fix: last tor runtime showed if never connected
    
    The header panel shows when arm was last detached from Tor. However, if we
    have never connected to a Tor control port then this is nonesense, showing
    the epoch time ("16:00 12/31/1969") instead. Dropping the field in this case.
---
 src/cli/headerPanel.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/cli/headerPanel.py b/src/cli/headerPanel.py
index 846c1db..5a2c1bc 100644
--- a/src/cli/headerPanel.py
+++ b/src/cli/headerPanel.py
@@ -204,10 +204,14 @@ class HeaderPanel(panel.Panel, threading.Thread):
         x += 17
       else:
         statusTime = torTools.getConn().getStatus()[1]
-        statusTimeLabel = time.strftime("%H:%M %m/%d/%Y", time.localtime(statusTime))
+        
+        if statusTime:
+          statusTimeLabel = time.strftime("%H:%M %m/%d/%Y, ", time.localtime(statusTime))
+        else: statusTimeLabel = "" # never connected to tor
+        
         self.addstr(1, x, "Tor Disconnected", curses.A_BOLD | uiTools.getColor("red"))
-        self.addstr(1, x + 16, " (%s, press r to reconnect)" % statusTimeLabel)
-        x += 41 + len(statusTimeLabel)
+        self.addstr(1, x + 16, " (%spress r to reconnect)" % statusTimeLabel)
+        x += 39 + len(statusTimeLabel)
         includeControlPort = False
     
     if includeControlPort:





More information about the tor-commits mailing list