aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_time_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_time_lib.h')
-rw-r--r--src/include/gnunet_time_lib.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index da22ab31e..d131e4eef 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -150,6 +150,22 @@ GNUNET_NETWORK_STRUCT_END
150#define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () 150#define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ ()
151 151
152 152
153
154/**
155 * Threshold after which exponential backoff should not increase (15 m).
156 */
157#define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
158
159
160/**
161 * Perform our standard exponential back-off calculation, starting at 1mst
162 * and then going by a factor of 2 up unto a maximum of 1s.
163 *
164 * @param r current backoff time, initially zero
165 */
166#define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min (GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \
167 GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2));
168
153/** 169/**
154 * Return relative time of 0ms. 170 * Return relative time of 0ms.
155 */ 171 */