aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-11 16:43:51 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-11 16:43:51 -0500
commitd5400d50e7ff0fe251c095ea7f29a82cd1045031 (patch)
tree5556a9e742ccc9452f055634d4c801f82329096d /src/or/rephist.c
parent252db6ad26900235f8904fa6b8d510551b9176cf (diff)
parentacc462c965acb90c2631797e10bb630eb2789e4e (diff)
downloadtor-d5400d50e7ff0fe251c095ea7f29a82cd1045031.tar.gz
tor-d5400d50e7ff0fe251c095ea7f29a82cd1045031.zip
Merge branch 'maint-0.3.2'
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index de4635ee59..15fb674fff 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1814,7 +1814,7 @@ static time_t last_prediction_add_time=0;
int
predicted_ports_prediction_time_remaining(time_t now)
{
- time_t idle_delta = now - last_prediction_add_time;
+ time_t idle_delta;
/* Protect against overflow of return value. This can happen if the clock
* jumps backwards in time. Update the last prediction time (aka last
@@ -1824,6 +1824,8 @@ predicted_ports_prediction_time_remaining(time_t now)
if (last_prediction_add_time > now) {
last_prediction_add_time = now;
idle_delta = 0;
+ } else {
+ idle_delta = now - last_prediction_add_time;
}
/* Protect against underflow of the return value. This can happen for very