[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] fix: last tor runtime showed if never connected
commit c2b4bd61b78b2b5fcda639c0f791f998223955ff
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
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:
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits