aboutsummaryrefslogtreecommitdiff
path: root/src/lib/intmath
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-12-04 12:21:14 -0500
committerNick Mathewson <nickm@torproject.org>2018-12-13 08:25:54 -0500
commitb5c04173c88369d0c4cdaf8a34c2474dc25c79fa (patch)
tree44cbe58c9b9282addf26fc4786f548a0bf1f48aa /src/lib/intmath
parentc037bf58173db56766381a7c1cd5973789f0fd0f (diff)
downloadtor-b5c04173c88369d0c4cdaf8a34c2474dc25c79fa.tar.gz
tor-b5c04173c88369d0c4cdaf8a34c2474dc25c79fa.zip
Change interaction between dormant mode and clock jumps.
When the clock jumps, and we have a record of last user activity, adjust that record. This way if I'm inactive for 10 minutes and then the laptop is sleeping for an hour, I'll still count as having been inactive for 10 minutes. Previously, we treat every jump as if it were activity, which is ridiculous, and would prevent a Tor instance with a jumpy clock from ever going dormant.
Diffstat (limited to 'src/lib/intmath')
-rw-r--r--src/lib/intmath/cmp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/intmath/cmp.h b/src/lib/intmath/cmp.h
index 16952bee3e..11b6fdf98e 100644
--- a/src/lib/intmath/cmp.h
+++ b/src/lib/intmath/cmp.h
@@ -36,4 +36,7 @@
((v) > (max)) ? (max) : \
(v) )
+/** Give the absolute value of <b>x</b>, independent of its type. */
+#define ABS(x) ( ((x)<0) ? -(x) : (x) )
+
#endif /* !defined(TOR_INTMATH_CMP_H) */