-fix time assertion introduce in last patch
[oweals/gnunet.git] / src / util / time.c
index fea0947bd2b80ff75bacb35c517a6efae984ce48..a615756280b803db0a4925edf6341e9a73de0742 100644 (file)
@@ -24,7 +24,7 @@
  * @brief functions for handling time and time arithmetic
  */
 #include "platform.h"
-#include "gnunet_time_lib.h"
+#include "gnunet_util_lib.h"
 
 #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
 
@@ -50,7 +50,7 @@ GNUNET_TIME_set_offset (long long offset)
  *
  * @return the offset we currently skew the locale time by
  */
-long long 
+long long
 GNUNET_TIME_get_offset ()
 {
   return timestamp_offset;
@@ -385,6 +385,8 @@ GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel,
 
   if (0 == factor)
     return GNUNET_TIME_UNIT_ZERO;
+  if (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
+    return GNUNET_TIME_UNIT_FOREVER_REL;
   ret.rel_value_us = rel.rel_value_us * (unsigned long long) factor;
   if (ret.rel_value_us / factor != rel.rel_value_us)
   {
@@ -579,10 +581,10 @@ GNUNET_TIME_get_current_year ()
 /**
  * Convert an expiration time to the respective year (rounds)
  *
- * @param at absolute time 
+ * @param at absolute time
  * @return year a year (after 1970), 0 on error
  */
-unsigned int 
+unsigned int
 GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at)
 {
   struct tm *t;