struct GNUNET_TIME_Absolute future;
struct GNUNET_TIME_Absolute past;
struct GNUNET_TIME_Absolute last;
+ struct GNUNET_TIME_Absolute forever;
+ struct GNUNET_TIME_Absolute zero;
struct GNUNET_TIME_Relative rel;
+ struct GNUNET_TIME_Relative relForever;
+ struct GNUNET_TIME_Relative relUnit;
struct GNUNET_TIME_RelativeNBO reln;
unsigned int i;
+ forever = GNUNET_TIME_absolute_get_forever ();
+ relForever = GNUNET_TIME_relative_get_forever ();
+ relUnit = GNUNET_TIME_relative_get_unit ();
+ zero.value = 0;
last = now = GNUNET_TIME_absolute_get ();
while (now.value == last.value)
/* test overflow checking in multiply */
rel = GNUNET_TIME_UNIT_SECONDS;
- GNUNET_log_skip (1);
+ GNUNET_log_skip (1, GNUNET_NO);
for (i = 0; i < 55; i++)
rel = GNUNET_TIME_relative_multiply (rel, 2);
- GNUNET_log_skip (0);
+ GNUNET_log_skip (0, GNUNET_NO);
GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value);
/* test infinity-check for relative to absolute */
/* check overflow for r2a */
rel.value = ((uint64_t) - 1LL) - 1024;
- GNUNET_log_skip (1);
+ GNUNET_log_skip (1, GNUNET_NO);
last = GNUNET_TIME_relative_to_absolute (rel);
- GNUNET_log_skip (0);
+ GNUNET_log_skip (0, GNUNET_NO);
GNUNET_assert (last.value == GNUNET_TIME_UNIT_FOREVER_ABS.value);
/* check overflow for relative add */
- GNUNET_log_skip (1);
+ GNUNET_log_skip (1, GNUNET_NO);
rel = GNUNET_TIME_relative_add (rel, rel);
- GNUNET_log_skip (0);
+ GNUNET_log_skip (0, GNUNET_NO);
GNUNET_assert (rel.value == GNUNET_TIME_UNIT_FOREVER_REL.value);
+ GNUNET_log_skip (1, GNUNET_NO);
+ rel = GNUNET_TIME_relative_add (relForever, relForever);
+ GNUNET_log_skip (0, GNUNET_NO);
+ GNUNET_assert (rel.value == relForever.value);
+
+ GNUNET_log_skip (1, GNUNET_NO);
+ rel = GNUNET_TIME_relative_add (relUnit, relUnit);
+ GNUNET_assert (rel.value == 2 * relUnit.value);
+
/* check relation check in get_duration */
future.value = now.value + 1000000;
GNUNET_assert (GNUNET_TIME_absolute_get_difference (now, future).value ==
GNUNET_assert (GNUNET_TIME_absolute_get_difference (future, now).value ==
0);
+ GNUNET_assert (GNUNET_TIME_absolute_get_difference (zero, forever).value ==
+ forever.value);
+
past.value = now.value - 1000000;
rel = GNUNET_TIME_absolute_get_duration (future);
GNUNET_assert (rel.value == 0);
future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_SECONDS);
GNUNET_assert (future.value == now.value + 1000);
+ future = GNUNET_TIME_absolute_add (forever, GNUNET_TIME_UNIT_ZERO);
+ GNUNET_assert (future.value == forever.value);
+
+ rel.value = ((uint64_t) - 1LL) - 1024;
+ now.value = rel.value;
+ future = GNUNET_TIME_absolute_add (now, rel);
+ GNUNET_assert (future.value == forever.value);
+
/* check zero */
future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_ZERO);
GNUNET_assert (future.value == now.value);