diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-04-07 16:07:47 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-04-07 16:07:47 +0000 |
commit | cb421d076cc32abcf73b54bfdeb4dcfabb54e8d0 (patch) | |
tree | 5ce4e7f1d28c9c830ae34b8f5912343a48f16412 /src/util/time.c | |
parent | 47afb3b4c553e503e0fed668c9d9f31c43518410 (diff) | |
download | gnunet-cb421d076cc32abcf73b54bfdeb4dcfabb54e8d0.tar.gz gnunet-cb421d076cc32abcf73b54bfdeb4dcfabb54e8d0.zip |
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.
Diffstat (limited to 'src/util/time.c')
-rw-r--r-- | src/util/time.c | 12 |
1 files 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, | |||
227 | 227 | ||
228 | /** | 228 | /** |
229 | * Get the duration of an operation as the | 229 | * Get the duration of an operation as the |
230 | * difference of the current time and the given start time "hence". | 230 | * difference of the current time and the given start time "whence". |
231 | * | 231 | * |
232 | * @return aborts if hence==FOREVER, 0 if hence > now, otherwise now-hence. | 232 | * @return aborts if whence==FOREVER, 0 if whence > now, otherwise now-whence. |
233 | */ | 233 | */ |
234 | struct GNUNET_TIME_Relative | 234 | struct GNUNET_TIME_Relative |
235 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute hence) | 235 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) |
236 | { | 236 | { |
237 | struct GNUNET_TIME_Absolute now; | 237 | struct GNUNET_TIME_Absolute now; |
238 | struct GNUNET_TIME_Relative ret; | 238 | struct GNUNET_TIME_Relative ret; |
239 | 239 | ||
240 | now = GNUNET_TIME_absolute_get (); | 240 | now = GNUNET_TIME_absolute_get (); |
241 | GNUNET_assert (hence.abs_value != UINT64_MAX); | 241 | GNUNET_assert (whence.abs_value != UINT64_MAX); |
242 | if (hence.abs_value > now.abs_value) | 242 | if (whence.abs_value > now.abs_value) |
243 | return GNUNET_TIME_relative_get_zero (); | 243 | return GNUNET_TIME_relative_get_zero (); |
244 | ret.rel_value = now.abs_value - hence.abs_value; | 244 | ret.rel_value = now.abs_value - whence.abs_value; |
245 | return ret; | 245 | return ret; |
246 | } | 246 | } |
247 | 247 | ||