[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Accounting info's time_until_reset incorrect
commit 11469cf3b5f012b3f5e152bd40e6dcce485787c2
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Oct 18 14:10:25 2014 -0700
Accounting info's time_until_reset incorrect
Oops. We inverted attributes always accounting a negative time_until_reset.
---
stem/control.py | 2 +-
test/unit/control/controller.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/stem/control.py b/stem/control.py
index 4688bd7..ed83a00 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -1246,7 +1246,7 @@ class Controller(BaseController):
retrieved = retrieved,
status = status,
interval_end = interval_end,
- time_until_reset = int(retrieved) - calendar.timegm(interval_end.timetuple()),
+ time_until_reset = calendar.timegm(interval_end.timetuple()) - int(retrieved),
read_bytes = used_read,
read_bytes_left = left_read,
read_limit = used_read + left_read,
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index 948068f..5e0058f 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -281,7 +281,7 @@ class TestControl(unittest.TestCase):
self.assertRaises(stem.ProtocolError, self.controller.get_socks_listeners)
@patch('stem.control.Controller.get_info')
- @patch('time.time', Mock(return_value = 1410723698.276578))
+ @patch('time.time', Mock(return_value = 1410723598.276578))
def test_get_accounting_stats(self, get_info_mock):
"""
Exercises the get_accounting_stats() method.
@@ -296,10 +296,10 @@ class TestControl(unittest.TestCase):
}[param]
expected = stem.control.AccountingStats(
- 1410723698.276578,
+ 1410723598.276578,
'awake',
datetime.datetime(2014, 9, 14, 19, 41),
- 38,
+ 62,
4837, 102944, 107781,
2050, 7440, 9490,
)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits