summaryrefslogtreecommitdiff
path: root/src/or/hibernate.c
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2011-04-29 01:18:32 +0200
committerSebastian Hahn <sebastian@torproject.org>2011-04-29 01:18:32 +0200
commit525d2700dd8b6c794a69ea0be63864baeff27617 (patch)
treefc085bfa348c9645e4798acd36aaac26185a999b /src/or/hibernate.c
parent30003e43180561eb92f4146d3bf2a5f74523cda6 (diff)
downloadtor-525d2700dd8b6c794a69ea0be63864baeff27617.tar.gz
tor-525d2700dd8b6c794a69ea0be63864baeff27617.zip
Correctly check elapsed time in last hibernation period
Fix bug 3020.
Diffstat (limited to 'src/or/hibernate.c')
-rw-r--r--src/or/hibernate.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 1878d5d52d..aebce4cc88 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -378,7 +378,8 @@ configure_accounting(time_t now)
/* We are in the interval we thought we were in. Do nothing.*/
interval_end_time = start_of_accounting_period_after(interval_start_time);
} else {
- long duration = length_of_accounting_period_containing(now);
+ long duration =
+ length_of_accounting_period_containing(interval_start_time);
double delta = ((double)(s_now - interval_start_time)) / duration;
if (-0.50 <= delta && delta <= 0.50) {
/* The start of the period is now a little later or earlier than we