aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-10-08 16:12:48 +0000
committerChristian Grothoff <christian@grothoff.org>2015-10-08 16:12:48 +0000
commitc95cd7a0899c5da94986c27df756e6555c5bd895 (patch)
treec746ffe8cf6af162ac2ef0fe9f72ffe36bf075ac
parent404e6ca13698dd6ceb92b71494989fb5d11ac403 (diff)
downloadgnunet-c95cd7a0899c5da94986c27df756e6555c5bd895.tar.gz
gnunet-c95cd7a0899c5da94986c27df756e6555c5bd895.zip
-make time API more intutitive
-rw-r--r--src/include/gnunet_time_lib.h2
-rw-r--r--src/util/time.c3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index b4b58f40c..c4e771eeb 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -349,7 +349,7 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start,
349 * difference of the current time and the given start time "hence". 349 * difference of the current time and the given start time "hence".
350 * 350 *
351 * @param whence some absolute time, typically in the past 351 * @param whence some absolute time, typically in the past
352 * @return aborts if hence==FOREVER, 0 if hence > now, otherwise now-hence. 352 * @return 0 if hence > now, otherwise now-hence.
353 */ 353 */
354struct GNUNET_TIME_Relative 354struct GNUNET_TIME_Relative
355GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence); 355GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence);
diff --git a/src/util/time.c b/src/util/time.c
index baf7ee67d..ba849e265 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -309,7 +309,7 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start,
309 * Get the duration of an operation as the 309 * Get the duration of an operation as the
310 * difference of the current time and the given start time "whence". 310 * difference of the current time and the given start time "whence".
311 * 311 *
312 * @return aborts if whence==FOREVER, 0 if whence > now, otherwise now-whence. 312 * @return 0 if whence > now, otherwise now-whence.
313 */ 313 */
314struct GNUNET_TIME_Relative 314struct GNUNET_TIME_Relative
315GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) 315GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence)
@@ -318,7 +318,6 @@ GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence)
318 struct GNUNET_TIME_Relative ret; 318 struct GNUNET_TIME_Relative ret;
319 319
320 now = GNUNET_TIME_absolute_get (); 320 now = GNUNET_TIME_absolute_get ();
321 GNUNET_assert (whence.abs_value_us != UINT64_MAX);
322 if (whence.abs_value_us > now.abs_value_us) 321 if (whence.abs_value_us > now.abs_value_us)
323 return GNUNET_TIME_UNIT_ZERO; 322 return GNUNET_TIME_UNIT_ZERO;
324 ret.rel_value_us = now.abs_value_us - whence.abs_value_us; 323 ret.rel_value_us = now.abs_value_us - whence.abs_value_us;