diff options
Diffstat (limited to 'src/include/gnunet_time_lib.h')
-rw-r--r-- | src/include/gnunet_time_lib.h | 161 |
1 files changed, 87 insertions, 74 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index 28a76e3ef..fd6010f5d 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -45,7 +45,8 @@ extern "C" | |||
45 | /** | 45 | /** |
46 | * Time for absolute times used by GNUnet, in microseconds. | 46 | * Time for absolute times used by GNUnet, in microseconds. |
47 | */ | 47 | */ |
48 | struct GNUNET_TIME_Absolute { | 48 | struct GNUNET_TIME_Absolute |
49 | { | ||
49 | /** | 50 | /** |
50 | * The actual value. | 51 | * The actual value. |
51 | */ | 52 | */ |
@@ -56,7 +57,8 @@ struct GNUNET_TIME_Absolute { | |||
56 | * Time for relative time used by GNUnet, in microseconds. | 57 | * Time for relative time used by GNUnet, in microseconds. |
57 | * Always positive, so we can only refer to future time. | 58 | * Always positive, so we can only refer to future time. |
58 | */ | 59 | */ |
59 | struct GNUNET_TIME_Relative { | 60 | struct GNUNET_TIME_Relative |
61 | { | ||
60 | /** | 62 | /** |
61 | * The actual value. | 63 | * The actual value. |
62 | */ | 64 | */ |
@@ -68,7 +70,8 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
68 | /** | 70 | /** |
69 | * Time for relative time used by GNUnet, in microseconds and in network byte order. | 71 | * Time for relative time used by GNUnet, in microseconds and in network byte order. |
70 | */ | 72 | */ |
71 | struct GNUNET_TIME_RelativeNBO { | 73 | struct GNUNET_TIME_RelativeNBO |
74 | { | ||
72 | /** | 75 | /** |
73 | * The actual value (in network byte order). | 76 | * The actual value (in network byte order). |
74 | */ | 77 | */ |
@@ -79,7 +82,8 @@ struct GNUNET_TIME_RelativeNBO { | |||
79 | /** | 82 | /** |
80 | * Time for absolute time used by GNUnet, in microseconds and in network byte order. | 83 | * Time for absolute time used by GNUnet, in microseconds and in network byte order. |
81 | */ | 84 | */ |
82 | struct GNUNET_TIME_AbsoluteNBO { | 85 | struct GNUNET_TIME_AbsoluteNBO |
86 | { | ||
83 | /** | 87 | /** |
84 | * The actual value (in network byte order). | 88 | * The actual value (in network byte order). |
85 | */ | 89 | */ |
@@ -90,76 +94,81 @@ GNUNET_NETWORK_STRUCT_END | |||
90 | /** | 94 | /** |
91 | * Relative time zero. | 95 | * Relative time zero. |
92 | */ | 96 | */ |
93 | #define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero_() | 97 | #define GNUNET_TIME_UNIT_ZERO GNUNET_TIME_relative_get_zero_ () |
94 | 98 | ||
95 | /** | 99 | /** |
96 | * Absolute time zero. | 100 | * Absolute time zero. |
97 | */ | 101 | */ |
98 | #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_() | 102 | #define GNUNET_TIME_UNIT_ZERO_ABS GNUNET_TIME_absolute_get_zero_ () |
99 | 103 | ||
100 | /** | 104 | /** |
101 | * One microsecond, our basic time unit. | 105 | * One microsecond, our basic time unit. |
102 | */ | 106 | */ |
103 | #define GNUNET_TIME_UNIT_MICROSECONDS GNUNET_TIME_relative_get_unit_() | 107 | #define GNUNET_TIME_UNIT_MICROSECONDS GNUNET_TIME_relative_get_unit_ () |
104 | 108 | ||
105 | /** | 109 | /** |
106 | * One millisecond. | 110 | * One millisecond. |
107 | */ | 111 | */ |
108 | #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_millisecond_() | 112 | #define GNUNET_TIME_UNIT_MILLISECONDS GNUNET_TIME_relative_get_millisecond_ () |
109 | 113 | ||
110 | /** | 114 | /** |
111 | * One second. | 115 | * One second. |
112 | */ | 116 | */ |
113 | #define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_() | 117 | #define GNUNET_TIME_UNIT_SECONDS GNUNET_TIME_relative_get_second_ () |
114 | 118 | ||
115 | /** | 119 | /** |
116 | * One minute. | 120 | * One minute. |
117 | */ | 121 | */ |
118 | #define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_() | 122 | #define GNUNET_TIME_UNIT_MINUTES GNUNET_TIME_relative_get_minute_ () |
119 | 123 | ||
120 | /** | 124 | /** |
121 | * One hour. | 125 | * One hour. |
122 | */ | 126 | */ |
123 | #define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_() | 127 | #define GNUNET_TIME_UNIT_HOURS GNUNET_TIME_relative_get_hour_ () |
124 | 128 | ||
125 | /** | 129 | /** |
126 | * One day. | 130 | * One day. |
127 | */ | 131 | */ |
128 | #define GNUNET_TIME_UNIT_DAYS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_HOURS, 24) | 132 | #define GNUNET_TIME_UNIT_DAYS GNUNET_TIME_relative_multiply ( \ |
133 | GNUNET_TIME_UNIT_HOURS, 24) | ||
129 | 134 | ||
130 | /** | 135 | /** |
131 | * One week. | 136 | * One week. |
132 | */ | 137 | */ |
133 | #define GNUNET_TIME_UNIT_WEEKS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 7) | 138 | #define GNUNET_TIME_UNIT_WEEKS GNUNET_TIME_relative_multiply ( \ |
139 | GNUNET_TIME_UNIT_DAYS, 7) | ||
134 | 140 | ||
135 | /** | 141 | /** |
136 | * One month (30 days). | 142 | * One month (30 days). |
137 | */ | 143 | */ |
138 | #define GNUNET_TIME_UNIT_MONTHS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 30) | 144 | #define GNUNET_TIME_UNIT_MONTHS GNUNET_TIME_relative_multiply ( \ |
145 | GNUNET_TIME_UNIT_DAYS, 30) | ||
139 | 146 | ||
140 | /** | 147 | /** |
141 | * One year (365 days). | 148 | * One year (365 days). |
142 | */ | 149 | */ |
143 | #define GNUNET_TIME_UNIT_YEARS GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_DAYS, 365) | 150 | #define GNUNET_TIME_UNIT_YEARS GNUNET_TIME_relative_multiply ( \ |
151 | GNUNET_TIME_UNIT_DAYS, 365) | ||
144 | 152 | ||
145 | /** | 153 | /** |
146 | * Constant used to specify "forever". This constant | 154 | * Constant used to specify "forever". This constant |
147 | * will be treated specially in all time operations. | 155 | * will be treated specially in all time operations. |
148 | */ | 156 | */ |
149 | #define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_() | 157 | #define GNUNET_TIME_UNIT_FOREVER_REL GNUNET_TIME_relative_get_forever_ () |
150 | 158 | ||
151 | /** | 159 | /** |
152 | * Constant used to specify "forever". This constant | 160 | * Constant used to specify "forever". This constant |
153 | * will be treated specially in all time operations. | 161 | * will be treated specially in all time operations. |
154 | */ | 162 | */ |
155 | #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_() | 163 | #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () |
156 | 164 | ||
157 | 165 | ||
158 | 166 | ||
159 | /** | 167 | /** |
160 | * Threshold after which exponential backoff should not increase (15 m). | 168 | * Threshold after which exponential backoff should not increase (15 m). |
161 | */ | 169 | */ |
162 | #define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MINUTES, 15) | 170 | #define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD \ |
171 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
163 | 172 | ||
164 | 173 | ||
165 | /** | 174 | /** |
@@ -168,8 +177,10 @@ GNUNET_NETWORK_STRUCT_END | |||
168 | * | 177 | * |
169 | * @param r current backoff time, initially zero | 178 | * @param r current backoff time, initially zero |
170 | */ | 179 | */ |
171 | #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min(GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ | 180 | #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min ( \ |
172 | GNUNET_TIME_relative_multiply(GNUNET_TIME_relative_max(GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)); | 181 | GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ |
182 | GNUNET_TIME_relative_multiply ( \ | ||
183 | GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)); | ||
173 | 184 | ||
174 | 185 | ||
175 | /** | 186 | /** |
@@ -182,7 +193,8 @@ GNUNET_NETWORK_STRUCT_END | |||
182 | * @return the next backoff time | 193 | * @return the next backoff time |
183 | */ | 194 | */ |
184 | struct GNUNET_TIME_Relative | 195 | struct GNUNET_TIME_Relative |
185 | GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt, struct GNUNET_TIME_Relative threshold); | 196 | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, struct |
197 | GNUNET_TIME_Relative threshold); | ||
186 | 198 | ||
187 | 199 | ||
188 | /** | 200 | /** |
@@ -192,70 +204,70 @@ GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt, struct GNUNET_TIM | |||
192 | * @return randomized time | 204 | * @return randomized time |
193 | */ | 205 | */ |
194 | struct GNUNET_TIME_Relative | 206 | struct GNUNET_TIME_Relative |
195 | GNUNET_TIME_randomize(struct GNUNET_TIME_Relative r); | 207 | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r); |
196 | 208 | ||
197 | 209 | ||
198 | /** | 210 | /** |
199 | * Return relative time of 0ms. | 211 | * Return relative time of 0ms. |
200 | */ | 212 | */ |
201 | struct GNUNET_TIME_Relative | 213 | struct GNUNET_TIME_Relative |
202 | GNUNET_TIME_relative_get_zero_(void); | 214 | GNUNET_TIME_relative_get_zero_ (void); |
203 | 215 | ||
204 | 216 | ||
205 | /** | 217 | /** |
206 | * Return absolute time of 0ms. | 218 | * Return absolute time of 0ms. |
207 | */ | 219 | */ |
208 | struct GNUNET_TIME_Absolute | 220 | struct GNUNET_TIME_Absolute |
209 | GNUNET_TIME_absolute_get_zero_(void); | 221 | GNUNET_TIME_absolute_get_zero_ (void); |
210 | 222 | ||
211 | 223 | ||
212 | /** | 224 | /** |
213 | * Return relative time of 1 microsecond. | 225 | * Return relative time of 1 microsecond. |
214 | */ | 226 | */ |
215 | struct GNUNET_TIME_Relative | 227 | struct GNUNET_TIME_Relative |
216 | GNUNET_TIME_relative_get_unit_(void); | 228 | GNUNET_TIME_relative_get_unit_ (void); |
217 | 229 | ||
218 | 230 | ||
219 | /** | 231 | /** |
220 | * Return relative time of 1ms. | 232 | * Return relative time of 1ms. |
221 | */ | 233 | */ |
222 | struct GNUNET_TIME_Relative | 234 | struct GNUNET_TIME_Relative |
223 | GNUNET_TIME_relative_get_millisecond_(void); | 235 | GNUNET_TIME_relative_get_millisecond_ (void); |
224 | 236 | ||
225 | 237 | ||
226 | /** | 238 | /** |
227 | * Return relative time of 1s. | 239 | * Return relative time of 1s. |
228 | */ | 240 | */ |
229 | struct GNUNET_TIME_Relative | 241 | struct GNUNET_TIME_Relative |
230 | GNUNET_TIME_relative_get_second_(void); | 242 | GNUNET_TIME_relative_get_second_ (void); |
231 | 243 | ||
232 | 244 | ||
233 | /** | 245 | /** |
234 | * Return relative time of 1 minute. | 246 | * Return relative time of 1 minute. |
235 | */ | 247 | */ |
236 | struct GNUNET_TIME_Relative | 248 | struct GNUNET_TIME_Relative |
237 | GNUNET_TIME_relative_get_minute_(void); | 249 | GNUNET_TIME_relative_get_minute_ (void); |
238 | 250 | ||
239 | 251 | ||
240 | /** | 252 | /** |
241 | * Return relative time of 1 hour. | 253 | * Return relative time of 1 hour. |
242 | */ | 254 | */ |
243 | struct GNUNET_TIME_Relative | 255 | struct GNUNET_TIME_Relative |
244 | GNUNET_TIME_relative_get_hour_(void); | 256 | GNUNET_TIME_relative_get_hour_ (void); |
245 | 257 | ||
246 | 258 | ||
247 | /** | 259 | /** |
248 | * Return "forever". | 260 | * Return "forever". |
249 | */ | 261 | */ |
250 | struct GNUNET_TIME_Relative | 262 | struct GNUNET_TIME_Relative |
251 | GNUNET_TIME_relative_get_forever_(void); | 263 | GNUNET_TIME_relative_get_forever_ (void); |
252 | 264 | ||
253 | 265 | ||
254 | /** | 266 | /** |
255 | * Return "forever". | 267 | * Return "forever". |
256 | */ | 268 | */ |
257 | struct GNUNET_TIME_Absolute | 269 | struct GNUNET_TIME_Absolute |
258 | GNUNET_TIME_absolute_get_forever_(void); | 270 | GNUNET_TIME_absolute_get_forever_ (void); |
259 | 271 | ||
260 | 272 | ||
261 | /** | 273 | /** |
@@ -264,7 +276,7 @@ GNUNET_TIME_absolute_get_forever_(void); | |||
264 | * @return the current time | 276 | * @return the current time |
265 | */ | 277 | */ |
266 | struct GNUNET_TIME_Absolute | 278 | struct GNUNET_TIME_Absolute |
267 | GNUNET_TIME_absolute_get(void); | 279 | GNUNET_TIME_absolute_get (void); |
268 | 280 | ||
269 | 281 | ||
270 | /** | 282 | /** |
@@ -275,7 +287,7 @@ GNUNET_TIME_absolute_get(void); | |||
275 | * @return timestamp that is "rel" in the future, or FOREVER if rel==FOREVER (or if we would overflow) | 287 | * @return timestamp that is "rel" in the future, or FOREVER if rel==FOREVER (or if we would overflow) |
276 | */ | 288 | */ |
277 | struct GNUNET_TIME_Absolute | 289 | struct GNUNET_TIME_Absolute |
278 | GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel); | 290 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel); |
279 | 291 | ||
280 | 292 | ||
281 | /** | 293 | /** |
@@ -287,7 +299,7 @@ GNUNET_TIME_relative_to_absolute(struct GNUNET_TIME_Relative rel); | |||
287 | * it was just now rounded | 299 | * it was just now rounded |
288 | */ | 300 | */ |
289 | int | 301 | int |
290 | GNUNET_TIME_round_abs(struct GNUNET_TIME_Absolute *at); | 302 | GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at); |
291 | 303 | ||
292 | 304 | ||
293 | /** | 305 | /** |
@@ -299,7 +311,7 @@ GNUNET_TIME_round_abs(struct GNUNET_TIME_Absolute *at); | |||
299 | * it was just now rounded | 311 | * it was just now rounded |
300 | */ | 312 | */ |
301 | int | 313 | int |
302 | GNUNET_TIME_round_rel(struct GNUNET_TIME_Relative *rt); | 314 | GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt); |
303 | 315 | ||
304 | 316 | ||
305 | /** | 317 | /** |
@@ -310,8 +322,8 @@ GNUNET_TIME_round_rel(struct GNUNET_TIME_Relative *rt); | |||
310 | * @return timestamp that is smaller | 322 | * @return timestamp that is smaller |
311 | */ | 323 | */ |
312 | struct GNUNET_TIME_Relative | 324 | struct GNUNET_TIME_Relative |
313 | GNUNET_TIME_relative_min(struct GNUNET_TIME_Relative t1, | 325 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, |
314 | struct GNUNET_TIME_Relative t2); | 326 | struct GNUNET_TIME_Relative t2); |
315 | 327 | ||
316 | 328 | ||
317 | 329 | ||
@@ -323,8 +335,8 @@ GNUNET_TIME_relative_min(struct GNUNET_TIME_Relative t1, | |||
323 | * @return timestamp that is larger | 335 | * @return timestamp that is larger |
324 | */ | 336 | */ |
325 | struct GNUNET_TIME_Relative | 337 | struct GNUNET_TIME_Relative |
326 | GNUNET_TIME_relative_max(struct GNUNET_TIME_Relative t1, | 338 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, |
327 | struct GNUNET_TIME_Relative t2); | 339 | struct GNUNET_TIME_Relative t2); |
328 | 340 | ||
329 | 341 | ||
330 | /** | 342 | /** |
@@ -335,8 +347,8 @@ GNUNET_TIME_relative_max(struct GNUNET_TIME_Relative t1, | |||
335 | * @return timestamp that is smaller | 347 | * @return timestamp that is smaller |
336 | */ | 348 | */ |
337 | struct GNUNET_TIME_Absolute | 349 | struct GNUNET_TIME_Absolute |
338 | GNUNET_TIME_absolute_min(struct GNUNET_TIME_Absolute t1, | 350 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, |
339 | struct GNUNET_TIME_Absolute t2); | 351 | struct GNUNET_TIME_Absolute t2); |
340 | 352 | ||
341 | 353 | ||
342 | /** | 354 | /** |
@@ -347,8 +359,8 @@ GNUNET_TIME_absolute_min(struct GNUNET_TIME_Absolute t1, | |||
347 | * @return timestamp that is smaller | 359 | * @return timestamp that is smaller |
348 | */ | 360 | */ |
349 | struct GNUNET_TIME_Absolute | 361 | struct GNUNET_TIME_Absolute |
350 | GNUNET_TIME_absolute_max(struct GNUNET_TIME_Absolute t1, | 362 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, |
351 | struct GNUNET_TIME_Absolute t2); | 363 | struct GNUNET_TIME_Absolute t2); |
352 | 364 | ||
353 | 365 | ||
354 | /** | 366 | /** |
@@ -359,7 +371,7 @@ GNUNET_TIME_absolute_max(struct GNUNET_TIME_Absolute t1, | |||
359 | * @return future - now, or 0 if now >= future, or FOREVER if future==FOREVER. | 371 | * @return future - now, or 0 if now >= future, or FOREVER if future==FOREVER. |
360 | */ | 372 | */ |
361 | struct GNUNET_TIME_Relative | 373 | struct GNUNET_TIME_Relative |
362 | GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future); | 374 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future); |
363 | 375 | ||
364 | 376 | ||
365 | /** | 377 | /** |
@@ -373,9 +385,9 @@ GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future); | |||
373 | * assuming it continues at the same speed | 385 | * assuming it continues at the same speed |
374 | */ | 386 | */ |
375 | struct GNUNET_TIME_Relative | 387 | struct GNUNET_TIME_Relative |
376 | GNUNET_TIME_calculate_eta(struct GNUNET_TIME_Absolute start, | 388 | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, |
377 | uint64_t finished, | 389 | uint64_t finished, |
378 | uint64_t total); | 390 | uint64_t total); |
379 | 391 | ||
380 | 392 | ||
381 | /** | 393 | /** |
@@ -388,8 +400,8 @@ GNUNET_TIME_calculate_eta(struct GNUNET_TIME_Absolute start, | |||
388 | * @return 0 if start >= end; FOREVER if end==FOREVER; otherwise end - start | 400 | * @return 0 if start >= end; FOREVER if end==FOREVER; otherwise end - start |
389 | */ | 401 | */ |
390 | struct GNUNET_TIME_Relative | 402 | struct GNUNET_TIME_Relative |
391 | GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, | 403 | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, |
392 | struct GNUNET_TIME_Absolute end); | 404 | struct GNUNET_TIME_Absolute end); |
393 | 405 | ||
394 | 406 | ||
395 | /** | 407 | /** |
@@ -400,7 +412,7 @@ GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, | |||
400 | * @return 0 if hence > now, otherwise now-hence. | 412 | * @return 0 if hence > now, otherwise now-hence. |
401 | */ | 413 | */ |
402 | struct GNUNET_TIME_Relative | 414 | struct GNUNET_TIME_Relative |
403 | GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence); | 415 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence); |
404 | 416 | ||
405 | 417 | ||
406 | /** | 418 | /** |
@@ -412,8 +424,8 @@ GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence); | |||
412 | * @return FOREVER if either argument is FOREVER or on overflow; start+duration otherwise | 424 | * @return FOREVER if either argument is FOREVER or on overflow; start+duration otherwise |
413 | */ | 425 | */ |
414 | struct GNUNET_TIME_Absolute | 426 | struct GNUNET_TIME_Absolute |
415 | GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, | 427 | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, |
416 | struct GNUNET_TIME_Relative duration); | 428 | struct GNUNET_TIME_Relative duration); |
417 | 429 | ||
418 | 430 | ||
419 | /** | 431 | /** |
@@ -425,8 +437,8 @@ GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, | |||
425 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise | 437 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise |
426 | */ | 438 | */ |
427 | struct GNUNET_TIME_Absolute | 439 | struct GNUNET_TIME_Absolute |
428 | GNUNET_TIME_absolute_subtract(struct GNUNET_TIME_Absolute start, | 440 | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, |
429 | struct GNUNET_TIME_Relative duration); | 441 | struct GNUNET_TIME_Relative duration); |
430 | 442 | ||
431 | 443 | ||
432 | /** | 444 | /** |
@@ -437,8 +449,8 @@ GNUNET_TIME_absolute_subtract(struct GNUNET_TIME_Absolute start, | |||
437 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | 449 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor |
438 | */ | 450 | */ |
439 | struct GNUNET_TIME_Relative | 451 | struct GNUNET_TIME_Relative |
440 | GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, | 452 | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, |
441 | unsigned long long factor); | 453 | unsigned long long factor); |
442 | 454 | ||
443 | 455 | ||
444 | /** | 456 | /** |
@@ -449,8 +461,8 @@ GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, | |||
449 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | 461 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor |
450 | */ | 462 | */ |
451 | struct GNUNET_TIME_Relative | 463 | struct GNUNET_TIME_Relative |
452 | GNUNET_TIME_relative_saturating_multiply(struct GNUNET_TIME_Relative rel, | 464 | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, |
453 | unsigned long long factor); | 465 | unsigned long long factor); |
454 | 466 | ||
455 | 467 | ||
456 | /** | 468 | /** |
@@ -461,8 +473,8 @@ GNUNET_TIME_relative_saturating_multiply(struct GNUNET_TIME_Relative rel, | |||
461 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor | 473 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor |
462 | */ | 474 | */ |
463 | struct GNUNET_TIME_Relative | 475 | struct GNUNET_TIME_Relative |
464 | GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, | 476 | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, |
465 | unsigned long long factor); | 477 | unsigned long long factor); |
466 | 478 | ||
467 | 479 | ||
468 | /** | 480 | /** |
@@ -473,8 +485,8 @@ GNUNET_TIME_relative_divide(struct GNUNET_TIME_Relative rel, | |||
473 | * @return FOREVER if either argument is FOREVER or on overflow; a1+a2 otherwise | 485 | * @return FOREVER if either argument is FOREVER or on overflow; a1+a2 otherwise |
474 | */ | 486 | */ |
475 | struct GNUNET_TIME_Relative | 487 | struct GNUNET_TIME_Relative |
476 | GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, | 488 | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, |
477 | struct GNUNET_TIME_Relative a2); | 489 | struct GNUNET_TIME_Relative a2); |
478 | 490 | ||
479 | 491 | ||
480 | /** | 492 | /** |
@@ -485,8 +497,8 @@ GNUNET_TIME_relative_add(struct GNUNET_TIME_Relative a1, | |||
485 | * @return ZERO if a2>=a1 (including both FOREVER), FOREVER if a1 is FOREVER, a1-a2 otherwise | 497 | * @return ZERO if a2>=a1 (including both FOREVER), FOREVER if a1 is FOREVER, a1-a2 otherwise |
486 | */ | 498 | */ |
487 | struct GNUNET_TIME_Relative | 499 | struct GNUNET_TIME_Relative |
488 | GNUNET_TIME_relative_subtract(struct GNUNET_TIME_Relative a1, | 500 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, |
489 | struct GNUNET_TIME_Relative a2); | 501 | struct GNUNET_TIME_Relative a2); |
490 | 502 | ||
491 | 503 | ||
492 | /** | 504 | /** |
@@ -496,7 +508,7 @@ GNUNET_TIME_relative_subtract(struct GNUNET_TIME_Relative a1, | |||
496 | * @return converted time value | 508 | * @return converted time value |
497 | */ | 509 | */ |
498 | struct GNUNET_TIME_RelativeNBO | 510 | struct GNUNET_TIME_RelativeNBO |
499 | GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a); | 511 | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a); |
500 | 512 | ||
501 | 513 | ||
502 | /** | 514 | /** |
@@ -506,7 +518,7 @@ GNUNET_TIME_relative_hton(struct GNUNET_TIME_Relative a); | |||
506 | * @return converted time value | 518 | * @return converted time value |
507 | */ | 519 | */ |
508 | struct GNUNET_TIME_Relative | 520 | struct GNUNET_TIME_Relative |
509 | GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a); | 521 | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a); |
510 | 522 | ||
511 | 523 | ||
512 | /** | 524 | /** |
@@ -516,7 +528,7 @@ GNUNET_TIME_relative_ntoh(struct GNUNET_TIME_RelativeNBO a); | |||
516 | * @return converted time value | 528 | * @return converted time value |
517 | */ | 529 | */ |
518 | struct GNUNET_TIME_AbsoluteNBO | 530 | struct GNUNET_TIME_AbsoluteNBO |
519 | GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a); | 531 | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a); |
520 | 532 | ||
521 | 533 | ||
522 | /** | 534 | /** |
@@ -526,7 +538,7 @@ GNUNET_TIME_absolute_hton(struct GNUNET_TIME_Absolute a); | |||
526 | * @return converted time value | 538 | * @return converted time value |
527 | */ | 539 | */ |
528 | struct GNUNET_TIME_Absolute | 540 | struct GNUNET_TIME_Absolute |
529 | GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a); | 541 | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a); |
530 | 542 | ||
531 | 543 | ||
532 | /** | 544 | /** |
@@ -535,7 +547,7 @@ GNUNET_TIME_absolute_ntoh(struct GNUNET_TIME_AbsoluteNBO a); | |||
535 | * @param offset the offset to skew the locale time by | 547 | * @param offset the offset to skew the locale time by |
536 | */ | 548 | */ |
537 | void | 549 | void |
538 | GNUNET_TIME_set_offset(long long offset); | 550 | GNUNET_TIME_set_offset (long long offset); |
539 | 551 | ||
540 | 552 | ||
541 | /** | 553 | /** |
@@ -544,14 +556,14 @@ GNUNET_TIME_set_offset(long long offset); | |||
544 | * @return the offset we currently skew the locale time by | 556 | * @return the offset we currently skew the locale time by |
545 | */ | 557 | */ |
546 | long long | 558 | long long |
547 | GNUNET_TIME_get_offset(void); | 559 | GNUNET_TIME_get_offset (void); |
548 | 560 | ||
549 | 561 | ||
550 | /** | 562 | /** |
551 | * Return the current year (i.e. '2011'). | 563 | * Return the current year (i.e. '2011'). |
552 | */ | 564 | */ |
553 | unsigned int | 565 | unsigned int |
554 | GNUNET_TIME_get_current_year(void); | 566 | GNUNET_TIME_get_current_year (void); |
555 | 567 | ||
556 | 568 | ||
557 | /** | 569 | /** |
@@ -561,7 +573,7 @@ GNUNET_TIME_get_current_year(void); | |||
561 | * @return absolute time for January 1st of that year. | 573 | * @return absolute time for January 1st of that year. |
562 | */ | 574 | */ |
563 | struct GNUNET_TIME_Absolute | 575 | struct GNUNET_TIME_Absolute |
564 | GNUNET_TIME_year_to_time(unsigned int year); | 576 | GNUNET_TIME_year_to_time (unsigned int year); |
565 | 577 | ||
566 | 578 | ||
567 | /** | 579 | /** |
@@ -571,7 +583,7 @@ GNUNET_TIME_year_to_time(unsigned int year); | |||
571 | * @return year a year (after 1970), 0 on error | 583 | * @return year a year (after 1970), 0 on error |
572 | */ | 584 | */ |
573 | unsigned int | 585 | unsigned int |
574 | GNUNET_TIME_time_to_year(struct GNUNET_TIME_Absolute at); | 586 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at); |
575 | 587 | ||
576 | 588 | ||
577 | /** | 589 | /** |
@@ -599,7 +611,8 @@ struct GNUNET_CONFIGURATION_Handle; | |||
599 | * @return monotonically increasing time | 611 | * @return monotonically increasing time |
600 | */ | 612 | */ |
601 | struct GNUNET_TIME_Absolute | 613 | struct GNUNET_TIME_Absolute |
602 | GNUNET_TIME_absolute_get_monotonic(const struct GNUNET_CONFIGURATION_Handle *cfg); | 614 | GNUNET_TIME_absolute_get_monotonic (const struct |
615 | GNUNET_CONFIGURATION_Handle *cfg); | ||
603 | 616 | ||
604 | 617 | ||
605 | #if 0 /* keep Emacsens' auto-indent happy */ | 618 | #if 0 /* keep Emacsens' auto-indent happy */ |