-fixes
[oweals/gnunet.git] / src / util / time.c
index f4d4c40703bce0fbadbd2617fd7be985fd485eb7..3a6f380413c8e894d87546bcd8bedf2ec8d5d2b0 100644 (file)
 #include "platform.h"
 #include "gnunet_time_lib.h"
 
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
+/**
+ * Variable used to simulate clock skew.  Used for testing, never in production.
+ */
 static long long timestamp_offset;
 
 /**
@@ -145,9 +150,8 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel)
  * @return timestamp that is smaller
  */
 struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_min (struct
-                          GNUNET_TIME_Relative
-                          t1, struct GNUNET_TIME_Relative t2)
+GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1,
+                          struct GNUNET_TIME_Relative t2)
 {
   return (t1.rel_value < t2.rel_value) ? t1 : t2;
 }
@@ -161,9 +165,8 @@ GNUNET_TIME_relative_min (struct
  * @return timestamp that is larger
  */
 struct GNUNET_TIME_Relative
-GNUNET_TIME_relative_max (struct
-                          GNUNET_TIME_Relative
-                          t1, struct GNUNET_TIME_Relative t2)
+GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1,
+                          struct GNUNET_TIME_Relative t2)
 {
   return (t1.rel_value > t2.rel_value) ? t1 : t2;
 }
@@ -178,9 +181,8 @@ GNUNET_TIME_relative_max (struct
  * @return timestamp that is smaller
  */
 struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_min (struct
-                          GNUNET_TIME_Absolute
-                          t1, struct GNUNET_TIME_Absolute t2)
+GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1,
+                          struct GNUNET_TIME_Absolute t2)
 {
   return (t1.abs_value < t2.abs_value) ? t1 : t2;
 }
@@ -191,12 +193,11 @@ GNUNET_TIME_absolute_min (struct
  *
  * @param t1 first timestamp
  * @param t2 other timestamp
- * @return timestamp that is smaller
+ * @return timestamp that is bigger
  */
 struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_max (struct
-                          GNUNET_TIME_Absolute
-                          t1, struct GNUNET_TIME_Absolute t2)
+GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1,
+                          struct GNUNET_TIME_Absolute t2)
 {
   return (t1.abs_value > t2.abs_value) ? t1 : t2;
 }
@@ -298,9 +299,8 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start,
  * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise
  */
 struct GNUNET_TIME_Absolute
-GNUNET_TIME_absolute_subtract (struct
-                               GNUNET_TIME_Absolute
-                               start, struct GNUNET_TIME_Relative duration)
+GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start,
+                               struct GNUNET_TIME_Relative duration)
 {
   struct GNUNET_TIME_Absolute ret;
 
@@ -358,7 +358,7 @@ GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel,
 
 
 /**
- * Calculate the estimate time of arrival/completion 
+ * Calculate the estimate time of arrival/completion
  * for an operation.
  *
  * @param start when did the operation start?
@@ -368,8 +368,8 @@ GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel,
  *        assuming it continues at the same speed
  */
 struct GNUNET_TIME_Relative
-GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start,
-                           uint64_t finished, uint64_t total)
+GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, uint64_t finished,
+                           uint64_t total)
 {
   struct GNUNET_TIME_Relative dur;
   double exp;