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

[tor-commits] [nyx/master] Use stem's datetime_to_unix



commit e974aca24e310fcec408fa88e709edbee5fb9153
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Oct 20 09:10:03 2015 -0700

    Use stem's datetime_to_unix
    
    Stem now has a helper for converting datetime objects to a unix timestamp. No
    need to have one of our own now.
---
 nyx/connection_panel.py |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/nyx/connection_panel.py b/nyx/connection_panel.py
index 0541911..ff6daf8 100644
--- a/nyx/connection_panel.py
+++ b/nyx/connection_panel.py
@@ -6,7 +6,6 @@ import re
 import time
 import collections
 import curses
-import datetime
 import itertools
 import threading
 
@@ -17,7 +16,7 @@ import nyx.util.ui_tools
 from nyx.util import panel, tor_controller, ui_tools
 
 from stem.control import Listener
-from stem.util import conf, connection, enum, str_tools
+from stem.util import datetime_to_unix, conf, connection, enum, str_tools
 
 try:
   # added in python 3.2
@@ -239,8 +238,7 @@ class CircuitEntry(Entry):
         nickname = consensus_tracker.get_relay_nickname(fingerprint)
         locale = tor_controller().get_info('ip-to-country/%s' % address, None)
 
-      created_timestamp = (self._circuit.created - datetime.datetime(1970, 1, 1)).total_seconds()
-      connection = nyx.util.tracker.Connection(created_timestamp, False, '127.0.0.1', 0, address, port, 'tcp')
+      connection = nyx.util.tracker.Connection(datetime_to_unix(self._circuit.created), False, '127.0.0.1', 0, address, port, 'tcp')
       return Line(self, line_type, connection, self._circuit, fingerprint, nickname, locale)
 
     header_line = line(self._circuit.path[-1][0] if self._circuit.status == 'BUILT' else None, LineType.CIRCUIT_HEADER)



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