From cb421d076cc32abcf73b54bfdeb4dcfabb54e8d0 Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Thu, 7 Apr 2011 16:07:47 +0000 Subject: [PATCH] I finally figured out why this function was so unintuitive to me. Hence indicates a time in the future, and this function operates on a time in the past. --- src/util/time.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/util/time.c b/src/util/time.c index b79946269..10e1e6ffa 100644 --- a/src/util/time.c +++ b/src/util/time.c @@ -227,21 +227,21 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, /** * Get the duration of an operation as the - * difference of the current time and the given start time "hence". + * difference of the current time and the given start time "whence". * - * @return aborts if hence==FOREVER, 0 if hence > now, otherwise now-hence. + * @return aborts if whence==FOREVER, 0 if whence > now, otherwise now-whence. */ struct GNUNET_TIME_Relative -GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute hence) +GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) { struct GNUNET_TIME_Absolute now; struct GNUNET_TIME_Relative ret; now = GNUNET_TIME_absolute_get (); - GNUNET_assert (hence.abs_value != UINT64_MAX); - if (hence.abs_value > now.abs_value) + GNUNET_assert (whence.abs_value != UINT64_MAX); + if (whence.abs_value > now.abs_value) return GNUNET_TIME_relative_get_zero (); - ret.rel_value = now.abs_value - hence.abs_value; + ret.rel_value = now.abs_value - whence.abs_value; return ret; } -- 2.25.1