bugfix
[oweals/gnunet.git] / src / util / time.c
index 3ae4725615cd03a8c761a6cc38dbb35950ce66c6..95fa89b9a82c13ac9db9651db42b1399dd6a7dce 100644 (file)
@@ -39,7 +39,7 @@ GNUNET_TIME_absolute_get ()
   struct GNUNET_TIME_Absolute ret;
   struct timeval tv;
 
-  gettimeofday (&tv, NULL);
+  GETTIMEOFDAY (&tv, NULL);
   ret.value = tv.tv_sec * 1000 + tv.tv_usec / 1000;
   return ret;
 }
@@ -107,6 +107,21 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel)
   return ret;
 }
 
+
+/**
+ * Return the minimum of two relative time values.
+ *
+ * @return timestamp that is smaller
+ */
+struct GNUNET_TIME_Relative GNUNET_TIME_relative_min (struct
+                                                     GNUNET_TIME_Relative
+                                                     t1,
+                                                     struct
+                                                     GNUNET_TIME_Relative t2)
+{
+  return (t1.value < t2.value) ? t1 : t2;
+}
+
 /**
  * Given a timestamp in the future, how much time
  * remains until then?