aboutsummaryrefslogtreecommitdiff
path: root/src/util/time.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2022-03-26 07:17:12 +0100
committerChristian Grothoff <grothoff@gnunet.org>2022-03-26 07:17:32 +0100
commite598ffe0a3a3d3db0df1fcc04f52bbefe93d3779 (patch)
tree5aa6266185d790886d46ec8d4a5ff7b38a33cac2 /src/util/time.c
parent104473d4e270ca5979c79d540c9144bb72121a36 (diff)
downloadgnunet-e598ffe0a3a3d3db0df1fcc04f52bbefe93d3779.tar.gz
gnunet-e598ffe0a3a3d3db0df1fcc04f52bbefe93d3779.zip
add GNUNET_TIME_absolute_round_down() function
Diffstat (limited to 'src/util/time.c')
-rw-r--r--src/util/time.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/util/time.c b/src/util/time.c
index aeec2b3f9..cf072aebf 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -386,6 +386,20 @@ GNUNET_TIME_timestamp_min (struct GNUNET_TIME_Timestamp t1,
386} 386}
387 387
388 388
389struct GNUNET_TIME_Absolute
390GNUNET_TIME_absolute_round_down (struct GNUNET_TIME_Absolute at,
391 struct GNUNET_TIME_Relative rt)
392{
393 struct GNUNET_TIME_Absolute ret;
394
395 GNUNET_assert (! GNUNET_TIME_relative_is_zero (rt));
396 ret.abs_value_us
397 = at.abs_value_us
398 - at.abs_value_us % rt.rel_value_us;
399 return ret;
400}
401
402
389struct GNUNET_TIME_Relative 403struct GNUNET_TIME_Relative
390GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) 404GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future)
391{ 405{