diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-04-11 01:36:40 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-04-11 01:36:40 +0200 |
commit | 85ac4003603512a07bb2daa59610c0bc9e01b1ff (patch) | |
tree | 01196b6e89409bbf72c0f060a9199418208b3bd4 /src/util | |
parent | 454901d507189ab7819b7da80fc18982c06a740d (diff) | |
download | gnunet-85ac4003603512a07bb2daa59610c0bc9e01b1ff.tar.gz gnunet-85ac4003603512a07bb2daa59610c0bc9e01b1ff.zip |
-remove duplicated comments
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/time.c | 249 |
1 files changed, 1 insertions, 248 deletions
diff --git a/src/util/time.c b/src/util/time.c index c1ad5e618..fcf18c893 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -44,11 +44,6 @@ | |||
44 | */ | 44 | */ |
45 | static long long timestamp_offset; | 45 | static long long timestamp_offset; |
46 | 46 | ||
47 | /** | ||
48 | * Set the timestamp offset for this instance. | ||
49 | * | ||
50 | * @param offset the offset to skew the locale time by | ||
51 | */ | ||
52 | void | 47 | void |
53 | GNUNET_TIME_set_offset (long long offset) | 48 | GNUNET_TIME_set_offset (long long offset) |
54 | { | 49 | { |
@@ -56,11 +51,6 @@ GNUNET_TIME_set_offset (long long offset) | |||
56 | } | 51 | } |
57 | 52 | ||
58 | 53 | ||
59 | /** | ||
60 | * Get the timestamp offset for this instance. | ||
61 | * | ||
62 | * @return the offset we currently skew the locale time by | ||
63 | */ | ||
64 | long long | 54 | long long |
65 | GNUNET_TIME_get_offset () | 55 | GNUNET_TIME_get_offset () |
66 | { | 56 | { |
@@ -68,14 +58,6 @@ GNUNET_TIME_get_offset () | |||
68 | } | 58 | } |
69 | 59 | ||
70 | 60 | ||
71 | /** | ||
72 | * Round a time value so that it is suitable for transmission | ||
73 | * via JSON encodings. | ||
74 | * | ||
75 | * @param at time to round | ||
76 | * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if | ||
77 | * it was just now rounded | ||
78 | */ | ||
79 | int | 61 | int |
80 | GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) | 62 | GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) |
81 | { | 63 | { |
@@ -88,14 +70,6 @@ GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) | |||
88 | } | 70 | } |
89 | 71 | ||
90 | 72 | ||
91 | /** | ||
92 | * Round a time value so that it is suitable for transmission | ||
93 | * via JSON encodings. | ||
94 | * | ||
95 | * @param rt time to round | ||
96 | * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if | ||
97 | * it was just now rounded | ||
98 | */ | ||
99 | int | 73 | int |
100 | GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) | 74 | GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) |
101 | { | 75 | { |
@@ -108,12 +82,6 @@ GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) | |||
108 | } | 82 | } |
109 | 83 | ||
110 | 84 | ||
111 | /** | ||
112 | * Get the current time (works just as "time", just that we use the | ||
113 | * unit of time that the cron-jobs use (and is 64 bit)). | ||
114 | * | ||
115 | * @return the current time | ||
116 | */ | ||
117 | struct GNUNET_TIME_Absolute | 85 | struct GNUNET_TIME_Absolute |
118 | GNUNET_TIME_absolute_get () | 86 | GNUNET_TIME_absolute_get () |
119 | { | 87 | { |
@@ -128,9 +96,6 @@ GNUNET_TIME_absolute_get () | |||
128 | } | 96 | } |
129 | 97 | ||
130 | 98 | ||
131 | /** | ||
132 | * Return relative time of 0ms. | ||
133 | */ | ||
134 | struct GNUNET_TIME_Relative | 99 | struct GNUNET_TIME_Relative |
135 | GNUNET_TIME_relative_get_zero_ () | 100 | GNUNET_TIME_relative_get_zero_ () |
136 | { | 101 | { |
@@ -140,9 +105,6 @@ GNUNET_TIME_relative_get_zero_ () | |||
140 | } | 105 | } |
141 | 106 | ||
142 | 107 | ||
143 | /** | ||
144 | * Return absolute time of 0ms. | ||
145 | */ | ||
146 | struct GNUNET_TIME_Absolute | 108 | struct GNUNET_TIME_Absolute |
147 | GNUNET_TIME_absolute_get_zero_ () | 109 | GNUNET_TIME_absolute_get_zero_ () |
148 | { | 110 | { |
@@ -152,9 +114,6 @@ GNUNET_TIME_absolute_get_zero_ () | |||
152 | } | 114 | } |
153 | 115 | ||
154 | 116 | ||
155 | /** | ||
156 | * Return relative time of 1us. | ||
157 | */ | ||
158 | struct GNUNET_TIME_Relative | 117 | struct GNUNET_TIME_Relative |
159 | GNUNET_TIME_relative_get_unit_ () | 118 | GNUNET_TIME_relative_get_unit_ () |
160 | { | 119 | { |
@@ -164,9 +123,6 @@ GNUNET_TIME_relative_get_unit_ () | |||
164 | } | 123 | } |
165 | 124 | ||
166 | 125 | ||
167 | /** | ||
168 | * Return relative time of 1ms. | ||
169 | */ | ||
170 | struct GNUNET_TIME_Relative | 126 | struct GNUNET_TIME_Relative |
171 | GNUNET_TIME_relative_get_millisecond_ () | 127 | GNUNET_TIME_relative_get_millisecond_ () |
172 | { | 128 | { |
@@ -176,9 +132,6 @@ GNUNET_TIME_relative_get_millisecond_ () | |||
176 | } | 132 | } |
177 | 133 | ||
178 | 134 | ||
179 | /** | ||
180 | * Return relative time of 1s. | ||
181 | */ | ||
182 | struct GNUNET_TIME_Relative | 135 | struct GNUNET_TIME_Relative |
183 | GNUNET_TIME_relative_get_second_ () | 136 | GNUNET_TIME_relative_get_second_ () |
184 | { | 137 | { |
@@ -188,9 +141,6 @@ GNUNET_TIME_relative_get_second_ () | |||
188 | } | 141 | } |
189 | 142 | ||
190 | 143 | ||
191 | /** | ||
192 | * Return relative time of 1 minute. | ||
193 | */ | ||
194 | struct GNUNET_TIME_Relative | 144 | struct GNUNET_TIME_Relative |
195 | GNUNET_TIME_relative_get_minute_ () | 145 | GNUNET_TIME_relative_get_minute_ () |
196 | { | 146 | { |
@@ -200,9 +150,6 @@ GNUNET_TIME_relative_get_minute_ () | |||
200 | } | 150 | } |
201 | 151 | ||
202 | 152 | ||
203 | /** | ||
204 | * Return relative time of 1 hour. | ||
205 | */ | ||
206 | struct GNUNET_TIME_Relative | 153 | struct GNUNET_TIME_Relative |
207 | GNUNET_TIME_relative_get_hour_ () | 154 | GNUNET_TIME_relative_get_hour_ () |
208 | { | 155 | { |
@@ -212,9 +159,6 @@ GNUNET_TIME_relative_get_hour_ () | |||
212 | } | 159 | } |
213 | 160 | ||
214 | 161 | ||
215 | /** | ||
216 | * Return "forever". | ||
217 | */ | ||
218 | struct GNUNET_TIME_Relative | 162 | struct GNUNET_TIME_Relative |
219 | GNUNET_TIME_relative_get_forever_ () | 163 | GNUNET_TIME_relative_get_forever_ () |
220 | { | 164 | { |
@@ -224,9 +168,6 @@ GNUNET_TIME_relative_get_forever_ () | |||
224 | } | 168 | } |
225 | 169 | ||
226 | 170 | ||
227 | /** | ||
228 | * Return "forever". | ||
229 | */ | ||
230 | struct GNUNET_TIME_Absolute | 171 | struct GNUNET_TIME_Absolute |
231 | GNUNET_TIME_absolute_get_forever_ () | 172 | GNUNET_TIME_absolute_get_forever_ () |
232 | { | 173 | { |
@@ -236,12 +177,6 @@ GNUNET_TIME_absolute_get_forever_ () | |||
236 | } | 177 | } |
237 | 178 | ||
238 | 179 | ||
239 | /** | ||
240 | * Convert relative time to an absolute time in the | ||
241 | * future. | ||
242 | * | ||
243 | * @return timestamp that is "rel" in the future, or FOREVER if rel==FOREVER (or if we would overflow) | ||
244 | */ | ||
245 | struct GNUNET_TIME_Absolute | 180 | struct GNUNET_TIME_Absolute |
246 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | 181 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) |
247 | { | 182 | { |
@@ -261,13 +196,6 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | |||
261 | } | 196 | } |
262 | 197 | ||
263 | 198 | ||
264 | /** | ||
265 | * Return the minimum of two relative time values. | ||
266 | * | ||
267 | * @param t1 first timestamp | ||
268 | * @param t2 other timestamp | ||
269 | * @return timestamp that is smaller | ||
270 | */ | ||
271 | struct GNUNET_TIME_Relative | 199 | struct GNUNET_TIME_Relative |
272 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, | 200 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, |
273 | struct GNUNET_TIME_Relative t2) | 201 | struct GNUNET_TIME_Relative t2) |
@@ -276,13 +204,6 @@ GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, | |||
276 | } | 204 | } |
277 | 205 | ||
278 | 206 | ||
279 | /** | ||
280 | * Return the maximum of two relative time values. | ||
281 | * | ||
282 | * @param t1 first timestamp | ||
283 | * @param t2 other timestamp | ||
284 | * @return timestamp that is larger | ||
285 | */ | ||
286 | struct GNUNET_TIME_Relative | 207 | struct GNUNET_TIME_Relative |
287 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, | 208 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, |
288 | struct GNUNET_TIME_Relative t2) | 209 | struct GNUNET_TIME_Relative t2) |
@@ -291,13 +212,6 @@ GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, | |||
291 | } | 212 | } |
292 | 213 | ||
293 | 214 | ||
294 | /** | ||
295 | * Return the minimum of two relative time values. | ||
296 | * | ||
297 | * @param t1 first timestamp | ||
298 | * @param t2 other timestamp | ||
299 | * @return timestamp that is smaller | ||
300 | */ | ||
301 | struct GNUNET_TIME_Absolute | 215 | struct GNUNET_TIME_Absolute |
302 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, | 216 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, |
303 | struct GNUNET_TIME_Absolute t2) | 217 | struct GNUNET_TIME_Absolute t2) |
@@ -306,13 +220,6 @@ GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, | |||
306 | } | 220 | } |
307 | 221 | ||
308 | 222 | ||
309 | /** | ||
310 | * Return the maximum of two relative time values. | ||
311 | * | ||
312 | * @param t1 first timestamp | ||
313 | * @param t2 other timestamp | ||
314 | * @return timestamp that is bigger | ||
315 | */ | ||
316 | struct GNUNET_TIME_Absolute | 223 | struct GNUNET_TIME_Absolute |
317 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, | 224 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, |
318 | struct GNUNET_TIME_Absolute t2) | 225 | struct GNUNET_TIME_Absolute t2) |
@@ -321,12 +228,6 @@ GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, | |||
321 | } | 228 | } |
322 | 229 | ||
323 | 230 | ||
324 | /** | ||
325 | * Given a timestamp in the future, how much time | ||
326 | * remains until then? | ||
327 | * | ||
328 | * @return future - now, or 0 if now >= future, or FOREVER if future==FOREVER. | ||
329 | */ | ||
330 | struct GNUNET_TIME_Relative | 231 | struct GNUNET_TIME_Relative |
331 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | 232 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) |
332 | { | 233 | { |
@@ -343,13 +244,6 @@ GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | |||
343 | } | 244 | } |
344 | 245 | ||
345 | 246 | ||
346 | /** | ||
347 | * Compute the time difference between the given start and end times. | ||
348 | * Use this function instead of actual subtraction to ensure that | ||
349 | * "FOREVER" and overflows are handled correctly. | ||
350 | * | ||
351 | * @return 0 if start >= end; FOREVER if end==FOREVER; otherwise end - start | ||
352 | */ | ||
353 | struct GNUNET_TIME_Relative | 247 | struct GNUNET_TIME_Relative |
354 | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | 248 | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, |
355 | struct GNUNET_TIME_Absolute end) | 249 | struct GNUNET_TIME_Absolute end) |
@@ -365,12 +259,6 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | |||
365 | } | 259 | } |
366 | 260 | ||
367 | 261 | ||
368 | /** | ||
369 | * Get the duration of an operation as the | ||
370 | * difference of the current time and the given start time "whence". | ||
371 | * | ||
372 | * @return 0 if whence > now, otherwise now-whence. | ||
373 | */ | ||
374 | struct GNUNET_TIME_Relative | 262 | struct GNUNET_TIME_Relative |
375 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) | 263 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) |
376 | { | 264 | { |
@@ -385,12 +273,6 @@ GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) | |||
385 | } | 273 | } |
386 | 274 | ||
387 | 275 | ||
388 | /** | ||
389 | * Add a given relative duration to the | ||
390 | * given start time. | ||
391 | * | ||
392 | * @return FOREVER if either argument is FOREVER or on overflow; start+duration otherwise | ||
393 | */ | ||
394 | struct GNUNET_TIME_Absolute | 276 | struct GNUNET_TIME_Absolute |
395 | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | 277 | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, |
396 | struct GNUNET_TIME_Relative duration) | 278 | struct GNUNET_TIME_Relative duration) |
@@ -402,7 +284,7 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | |||
402 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 284 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
403 | if (start.abs_value_us + duration.rel_value_us < start.abs_value_us) | 285 | if (start.abs_value_us + duration.rel_value_us < start.abs_value_us) |
404 | { | 286 | { |
405 | GNUNET_break (0); | 287 | GNUNET_assert (0); |
406 | return GNUNET_TIME_UNIT_FOREVER_ABS; | 288 | return GNUNET_TIME_UNIT_FOREVER_ABS; |
407 | } | 289 | } |
408 | ret.abs_value_us = start.abs_value_us + duration.rel_value_us; | 290 | ret.abs_value_us = start.abs_value_us + duration.rel_value_us; |
@@ -410,14 +292,6 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | |||
410 | } | 292 | } |
411 | 293 | ||
412 | 294 | ||
413 | /** | ||
414 | * Subtract a given relative duration from the | ||
415 | * given start time. | ||
416 | * | ||
417 | * @param start some absolute time | ||
418 | * @param duration some relative time to subtract | ||
419 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise | ||
420 | */ | ||
421 | struct GNUNET_TIME_Absolute | 295 | struct GNUNET_TIME_Absolute |
422 | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, | 296 | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, |
423 | struct GNUNET_TIME_Relative duration) | 297 | struct GNUNET_TIME_Relative duration) |
@@ -433,11 +307,6 @@ GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, | |||
433 | } | 307 | } |
434 | 308 | ||
435 | 309 | ||
436 | /** | ||
437 | * Multiply relative time by a given factor. | ||
438 | * | ||
439 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
440 | */ | ||
441 | struct GNUNET_TIME_Relative | 310 | struct GNUNET_TIME_Relative |
442 | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, | 311 | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, |
443 | unsigned long long factor) | 312 | unsigned long long factor) |
@@ -458,12 +327,6 @@ GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, | |||
458 | } | 327 | } |
459 | 328 | ||
460 | 329 | ||
461 | /** | ||
462 | * Multiply relative time by a given floating-point factor. The factor must be | ||
463 | * positive. | ||
464 | * | ||
465 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
466 | */ | ||
467 | struct GNUNET_TIME_Relative | 330 | struct GNUNET_TIME_Relative |
468 | relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) | 331 | relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) |
469 | { | 332 | { |
@@ -490,13 +353,6 @@ relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) | |||
490 | } | 353 | } |
491 | 354 | ||
492 | 355 | ||
493 | /** | ||
494 | * Saturating multiply relative time by a given factor. | ||
495 | * | ||
496 | * @param rel some duration | ||
497 | * @param factor integer to multiply with | ||
498 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
499 | */ | ||
500 | struct GNUNET_TIME_Relative | 356 | struct GNUNET_TIME_Relative |
501 | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, | 357 | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, |
502 | unsigned long long factor) | 358 | unsigned long long factor) |
@@ -516,13 +372,6 @@ GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, | |||
516 | } | 372 | } |
517 | 373 | ||
518 | 374 | ||
519 | /** | ||
520 | * Divide relative time by a given factor. | ||
521 | * | ||
522 | * @param rel some duration | ||
523 | * @param factor integer to divide by | ||
524 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor | ||
525 | */ | ||
526 | struct GNUNET_TIME_Relative | 375 | struct GNUNET_TIME_Relative |
527 | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, | 376 | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, |
528 | unsigned long long factor) | 377 | unsigned long long factor) |
@@ -537,16 +386,6 @@ GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, | |||
537 | } | 386 | } |
538 | 387 | ||
539 | 388 | ||
540 | /** | ||
541 | * Calculate the estimate time of arrival/completion | ||
542 | * for an operation. | ||
543 | * | ||
544 | * @param start when did the operation start? | ||
545 | * @param finished how much has been done? | ||
546 | * @param total how much must be done overall (same unit as for "finished") | ||
547 | * @return remaining duration for the operation, | ||
548 | * assuming it continues at the same speed | ||
549 | */ | ||
550 | struct GNUNET_TIME_Relative | 389 | struct GNUNET_TIME_Relative |
551 | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, | 390 | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, |
552 | uint64_t finished, | 391 | uint64_t finished, |
@@ -568,13 +407,6 @@ GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, | |||
568 | } | 407 | } |
569 | 408 | ||
570 | 409 | ||
571 | /** | ||
572 | * Add relative times together. | ||
573 | * | ||
574 | * @param a1 first timestamp | ||
575 | * @param a2 second timestamp | ||
576 | * @return FOREVER if either argument is FOREVER or on overflow; a1+a2 otherwise | ||
577 | */ | ||
578 | struct GNUNET_TIME_Relative | 410 | struct GNUNET_TIME_Relative |
579 | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | 411 | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, |
580 | struct GNUNET_TIME_Relative a2) | 412 | struct GNUNET_TIME_Relative a2) |
@@ -593,13 +425,6 @@ GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | |||
593 | } | 425 | } |
594 | 426 | ||
595 | 427 | ||
596 | /** | ||
597 | * Subtract relative timestamp from the other. | ||
598 | * | ||
599 | * @param a1 first timestamp | ||
600 | * @param a2 second timestamp | ||
601 | * @return ZERO if a2>=a1 (including both FOREVER), FOREVER if a1 is FOREVER, a1-a2 otherwise | ||
602 | */ | ||
603 | struct GNUNET_TIME_Relative | 428 | struct GNUNET_TIME_Relative |
604 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | 429 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, |
605 | struct GNUNET_TIME_Relative a2) | 430 | struct GNUNET_TIME_Relative a2) |
@@ -615,12 +440,6 @@ GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | |||
615 | } | 440 | } |
616 | 441 | ||
617 | 442 | ||
618 | /** | ||
619 | * Convert relative time to network byte order. | ||
620 | * | ||
621 | * @param a time to convert | ||
622 | * @return time in network byte order | ||
623 | */ | ||
624 | struct GNUNET_TIME_RelativeNBO | 443 | struct GNUNET_TIME_RelativeNBO |
625 | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | 444 | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) |
626 | { | 445 | { |
@@ -631,12 +450,6 @@ GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | |||
631 | } | 450 | } |
632 | 451 | ||
633 | 452 | ||
634 | /** | ||
635 | * Convert relative time from network byte order. | ||
636 | * | ||
637 | * @param a time to convert | ||
638 | * @return time in host byte order | ||
639 | */ | ||
640 | struct GNUNET_TIME_Relative | 453 | struct GNUNET_TIME_Relative |
641 | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | 454 | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) |
642 | { | 455 | { |
@@ -647,12 +460,6 @@ GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | |||
647 | } | 460 | } |
648 | 461 | ||
649 | 462 | ||
650 | /** | ||
651 | * Convert absolute time to network byte order. | ||
652 | * | ||
653 | * @param a time to convert | ||
654 | * @return time in network byte order | ||
655 | */ | ||
656 | struct GNUNET_TIME_AbsoluteNBO | 463 | struct GNUNET_TIME_AbsoluteNBO |
657 | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | 464 | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) |
658 | { | 465 | { |
@@ -663,12 +470,6 @@ GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | |||
663 | } | 470 | } |
664 | 471 | ||
665 | 472 | ||
666 | /** | ||
667 | * Convert absolute time from network byte order. | ||
668 | * | ||
669 | * @param a time to convert | ||
670 | * @return time in host byte order | ||
671 | */ | ||
672 | struct GNUNET_TIME_Absolute | 473 | struct GNUNET_TIME_Absolute |
673 | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | 474 | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) |
674 | { | 475 | { |
@@ -679,9 +480,6 @@ GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | |||
679 | } | 480 | } |
680 | 481 | ||
681 | 482 | ||
682 | /** | ||
683 | * Return the current year (i.e. '2011'). | ||
684 | */ | ||
685 | unsigned int | 483 | unsigned int |
686 | GNUNET_TIME_get_current_year () | 484 | GNUNET_TIME_get_current_year () |
687 | { | 485 | { |
@@ -696,12 +494,6 @@ GNUNET_TIME_get_current_year () | |||
696 | } | 494 | } |
697 | 495 | ||
698 | 496 | ||
699 | /** | ||
700 | * Convert an expiration time to the respective year (rounds) | ||
701 | * | ||
702 | * @param at absolute time | ||
703 | * @return year a year (after 1970), 0 on error | ||
704 | */ | ||
705 | unsigned int | 497 | unsigned int |
706 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) | 498 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) |
707 | { | 499 | { |
@@ -742,12 +534,6 @@ my_timegm (struct tm *tm) | |||
742 | #endif | 534 | #endif |
743 | 535 | ||
744 | 536 | ||
745 | /** | ||
746 | * Convert a year to an expiration time of January 1st of that year. | ||
747 | * | ||
748 | * @param year a year (after 1970, please ;-)). | ||
749 | * @return absolute time for January 1st of that year. | ||
750 | */ | ||
751 | struct GNUNET_TIME_Absolute | 537 | struct GNUNET_TIME_Absolute |
752 | GNUNET_TIME_year_to_time (unsigned int year) | 538 | GNUNET_TIME_year_to_time (unsigned int year) |
753 | { | 539 | { |
@@ -777,15 +563,6 @@ GNUNET_TIME_year_to_time (unsigned int year) | |||
777 | } | 563 | } |
778 | 564 | ||
779 | 565 | ||
780 | /** | ||
781 | * Randomized exponential back-off, starting at 1 ms | ||
782 | * and going up by a factor of 2+r, where 0 <= r < 0.5, up | ||
783 | * to a maximum of the given threshold. | ||
784 | * | ||
785 | * @param r current backoff time, initially zero | ||
786 | * @param threshold maximum value for backoff | ||
787 | * @return the next backoff time | ||
788 | */ | ||
789 | struct GNUNET_TIME_Relative | 566 | struct GNUNET_TIME_Relative |
790 | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, | 567 | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, |
791 | struct GNUNET_TIME_Relative threshold) | 568 | struct GNUNET_TIME_Relative threshold) |
@@ -800,12 +577,6 @@ GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, | |||
800 | } | 577 | } |
801 | 578 | ||
802 | 579 | ||
803 | /** | ||
804 | * Return a random time value between 0.5*r and 1.5*r. | ||
805 | * | ||
806 | * @param r input time for scaling | ||
807 | * @return randomized time | ||
808 | */ | ||
809 | struct GNUNET_TIME_Relative | 580 | struct GNUNET_TIME_Relative |
810 | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) | 581 | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) |
811 | { | 582 | { |
@@ -815,24 +586,6 @@ GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) | |||
815 | } | 586 | } |
816 | 587 | ||
817 | 588 | ||
818 | /** | ||
819 | * Obtain the current time and make sure it is monotonically | ||
820 | * increasing. Guards against systems without an RTC or | ||
821 | * clocks running backwards and other nasty surprises. Does | ||
822 | * not guarantee that the returned time is near the current | ||
823 | * time returned by #GNUNET_TIME_absolute_get(). Two | ||
824 | * subsequent calls (within a short time period) may return the | ||
825 | * same value. Persists the last returned time on disk to | ||
826 | * ensure that time never goes backwards. As a result, the | ||
827 | * resulting value can be used to check if a message is the | ||
828 | * "most recent" value and replays of older messages (from | ||
829 | * the same origin) would be discarded. | ||
830 | * | ||
831 | * @param cfg configuration, used to determine where to | ||
832 | * store the time; user can also insist RTC is working | ||
833 | * nicely and disable the feature | ||
834 | * @return monotonically increasing time | ||
835 | */ | ||
836 | struct GNUNET_TIME_Absolute | 589 | struct GNUNET_TIME_Absolute |
837 | GNUNET_TIME_absolute_get_monotonic ( | 590 | GNUNET_TIME_absolute_get_monotonic ( |
838 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 591 | const struct GNUNET_CONFIGURATION_Handle *cfg) |