From: Christian Grothoff Date: Fri, 2 Oct 2009 12:54:39 +0000 (+0000) Subject: absmin X-Git-Tag: initial-import-from-subversion-38251~23423 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=de9f2917b2abcd271391e6d573ff7ea67ef28be1;p=oweals%2Fgnunet.git absmin --- 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?