From de9f2917b2abcd271391e6d573ff7ea67ef28be1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 2 Oct 2009 12:54:39 +0000 Subject: [PATCH] absmin --- src/include/gnunet_time_lib.h | 13 +++++++++++++ src/util/time.c | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index 3b901f526..d00867e80 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h @@ -204,6 +204,19 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct struct GNUNET_TIME_Relative t2); +/** + * Return the minimum of two absolute time values. + * + * @param t1 first timestamp + * @param t2 other timestamp + * @return timestamp that is smaller + */ +struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct + GNUNET_TIME_Absolute + t1, + struct + GNUNET_TIME_Absolute t2); + /** * Given a timestamp in the future, how much time * remains until then? diff --git a/src/util/time.c b/src/util/time.c index f818fc9a1..6d67363a8 100644 --- a/src/util/time.c +++ b/src/util/time.c @@ -122,6 +122,8 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) /** * Return the minimum of two relative time values. * + * @param t1 first timestamp + * @param t2 other timestamp * @return timestamp that is smaller */ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct @@ -133,6 +135,24 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct return (t1.value < t2.value) ? t1 : t2; } + + +/** + * Return the minimum of two relative time values. + * + * @param t1 first timestamp + * @param t2 other timestamp + * @return timestamp that is smaller + */ +struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct + GNUNET_TIME_Absolute + t1, + struct + GNUNET_TIME_Absolute t2) +{ + return (t1.value < t2.value) ? t1 : t2; +} + /** * Given a timestamp in the future, how much time * remains until then? -- 2.25.1