aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-08-08 09:39:48 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-08 09:39:48 -0400
commita4400a77a5db2fc60db258857a23a11ec741e426 (patch)
treebc93b84d6b84e72b92f37d68c9e65297b2d7a949 /src/feature
parent70d0b97ee67381d901ed350fc7fdb1e98e1975c6 (diff)
parent878f4409015f741c7075d0ccf3da794a6f313302 (diff)
downloadtor-a4400a77a5db2fc60db258857a23a11ec741e426.tar.gz
tor-a4400a77a5db2fc60db258857a23a11ec741e426.zip
Merge branch 'ticket31343_029' into ticket31343_035
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/nodelist/routerlist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c
index 4a99427cd6..456f930aa3 100644
--- a/src/feature/nodelist/routerlist.c
+++ b/src/feature/nodelist/routerlist.c
@@ -2856,7 +2856,7 @@ int
router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
{
time_t r1pub, r2pub;
- long time_difference;
+ time_t time_difference;
tor_assert(r1 && r2);
/* r1 should be the one that was published first. */
@@ -2920,7 +2920,9 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
* give or take some slop? */
r1pub = r1->cache_info.published_on;
r2pub = r2->cache_info.published_on;
- time_difference = labs(r2->uptime - (r1->uptime + (r2pub - r1pub)));
+ time_difference = r2->uptime - (r1->uptime + (r2pub - r1pub));
+ if (time_difference < 0)
+ time_difference = - time_difference;
if (time_difference > ROUTER_ALLOW_UPTIME_DRIFT &&
time_difference > r1->uptime * .05 &&
time_difference > r2->uptime * .05)