aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_time_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-12-13 17:30:08 +0100
committerChristian Grothoff <christian@grothoff.org>2018-12-13 17:30:16 +0100
commitbdb3420bc937f0ab9187695a56f0e63d7c227f00 (patch)
tree14e1995fbb0d12c2049afd04515ed3337261627a /src/include/gnunet_time_lib.h
parentfe4f3105b7b0f6bc3160b1396fe7af07bde0bd8d (diff)
downloadgnunet-bdb3420bc937f0ab9187695a56f0e63d7c227f00.tar.gz
gnunet-bdb3420bc937f0ab9187695a56f0e63d7c227f00.zip
add function to obtain monotonic time
Diffstat (limited to 'src/include/gnunet_time_lib.h')
-rw-r--r--src/include/gnunet_time_lib.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index c7a06ba23..674a95534 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -365,7 +365,8 @@ GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future);
365 * assuming it continues at the same speed 365 * assuming it continues at the same speed
366 */ 366 */
367struct GNUNET_TIME_Relative 367struct GNUNET_TIME_Relative
368GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, uint64_t finished, 368GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start,
369 uint64_t finished,
369 uint64_t total); 370 uint64_t total);
370 371
371 372
@@ -565,6 +566,34 @@ unsigned int
565GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at); 566GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at);
566 567
567 568
569/**
570 * A configuration object.
571 */
572struct GNUNET_CONFIGURATION_Handle;
573
574
575/**
576 * Obtain the current time and make sure it is monotonically
577 * increasing. Guards against systems without an RTC or
578 * clocks running backwards and other nasty surprises. Does
579 * not guarantee that the returned time is near the current
580 * time returned by #GNUNET_TIME_absolute_get(). Two
581 * subsequent calls (within a short time period) may return the
582 * same value. Persists the last returned time on disk to
583 * ensure that time never goes backwards. As a result, the
584 * resulting value can be used to check if a message is the
585 * "most recent" value and replays of older messages (from
586 * the same origin) would be discarded.
587 *
588 * @param cfg configuration, used to determine where to
589 * store the time; user can also insist RTC is working
590 * nicely and disable the feature
591 * @return monotonically increasing time
592 */
593struct GNUNET_TIME_Absolute
594GNUNET_TIME_absolute_get_monotonic (const struct GNUNET_CONFIGURATION_Handle *cfg);
595
596
568#if 0 /* keep Emacsens' auto-indent happy */ 597#if 0 /* keep Emacsens' auto-indent happy */
569{ 598{
570#endif 599#endif