use putenv instead of setenv for portability
[oweals/gnunet.git] / src / util / test_scheduler_delay.c
index 24d30be99820c7c1f2741c25739f03ca95ad3ee2..ff6966a87a68b625039b0b2f0f049f2493b8ebf4 100644 (file)
@@ -28,7 +28,7 @@
 #include "gnunet_scheduler_lib.h"
 #include "gnunet_time_lib.h"
 
-#define VERBOSE GNUNET_NO
+#define VERBOSE GNUNET_EXTRA_LOGGING
 
 static struct GNUNET_TIME_Absolute target;
 
@@ -57,18 +57,17 @@ test_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   else
     cumDelta += (target.abs_value - now.abs_value);
   target =
-    GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
-                                      (GNUNET_TIME_UNIT_MILLISECONDS, i));
+      GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
+                                        (GNUNET_TIME_UNIT_MILLISECONDS, i));
   fprintf (stderr, ".");
   if (i > MAXV)
-    {
-      fprintf (stderr, "\n");
-      return;
-    }
-  GNUNET_SCHEDULER_add_delayed (tc->sched,
-                                GNUNET_TIME_relative_multiply
-                                (GNUNET_TIME_UNIT_MILLISECONDS, i),
-                                &test_task, NULL);
+  {
+    fprintf (stderr, "\n");
+    return;
+  }
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+                                (GNUNET_TIME_UNIT_MILLISECONDS, i), &test_task,
+                                NULL);
   i += INCR;
 }
 
@@ -77,8 +76,8 @@ check ()
 {
   target = GNUNET_TIME_absolute_get ();
   GNUNET_SCHEDULER_run (&test_task, NULL);
-  FPRINTF (stdout,
-           "Sleep precision: %llu ms. ", cumDelta / 1000 / (MAXV / INCR));
+  FPRINTF (stdout, "Sleep precision: %llu ms. ",
+           cumDelta / 1000 / (MAXV / INCR));
   if (cumDelta <= 10 * MAXV / INCR)
     fprintf (stdout, "Timer precision is excellent.\n");
   else if (cumDelta <= 50 * MAXV / INCR)        /* 50 ms average deviation */