#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;
/**
* @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;
}
* @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;
}
* @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;
}
*
* @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;
}
* @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;
/**
- * Calculate the estimate time of arrival/completion
+ * Calculate the estimate time of arrival/completion
* for an operation.
*
* @param start when did the operation start?
* 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;