aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-02 12:54:39 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-02 12:54:39 +0000
commitde9f2917b2abcd271391e6d573ff7ea67ef28be1 (patch)
treece6b58b562428d78ff7d5dbdb063017a3f877f06
parentfcd40dcd667f5f173c5f810c2cc196942ac8142c (diff)
downloadgnunet-de9f2917b2abcd271391e6d573ff7ea67ef28be1.tar.gz
gnunet-de9f2917b2abcd271391e6d573ff7ea67ef28be1.zip
absmin
-rw-r--r--src/include/gnunet_time_lib.h13
-rw-r--r--src/util/time.c20
2 files changed, 33 insertions, 0 deletions
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
@@ -205,6 +205,19 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct
205 GNUNET_TIME_Relative t2); 205 GNUNET_TIME_Relative t2);
206 206
207/** 207/**
208 * Return the minimum of two absolute time values.
209 *
210 * @param t1 first timestamp
211 * @param t2 other timestamp
212 * @return timestamp that is smaller
213 */
214struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct
215 GNUNET_TIME_Absolute
216 t1,
217 struct
218 GNUNET_TIME_Absolute t2);
219
220/**
208 * Given a timestamp in the future, how much time 221 * Given a timestamp in the future, how much time
209 * remains until then? 222 * remains until then?
210 * 223 *
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)
122/** 122/**
123 * Return the minimum of two relative time values. 123 * Return the minimum of two relative time values.
124 * 124 *
125 * @param t1 first timestamp
126 * @param t2 other timestamp
125 * @return timestamp that is smaller 127 * @return timestamp that is smaller
126 */ 128 */
127struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct 129struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct
@@ -133,6 +135,24 @@ struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct
133 return (t1.value < t2.value) ? t1 : t2; 135 return (t1.value < t2.value) ? t1 : t2;
134} 136}
135 137
138
139
140/**
141 * Return the minimum of two relative time values.
142 *
143 * @param t1 first timestamp
144 * @param t2 other timestamp
145 * @return timestamp that is smaller
146 */
147struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_min (struct
148 GNUNET_TIME_Absolute
149 t1,
150 struct
151 GNUNET_TIME_Absolute t2)
152{
153 return (t1.value < t2.value) ? t1 : t2;
154}
155
136/** 156/**
137 * Given a timestamp in the future, how much time 157 * Given a timestamp in the future, how much time
138 * remains until then? 158 * remains until then?