use arm timeouts, bad GNUNET_TIME function that will probably get removed
authorNathan S. Evans <evans@in.tum.de>
Wed, 27 Jul 2011 15:49:02 +0000 (15:49 +0000)
committerNathan S. Evans <evans@in.tum.de>
Wed, 27 Jul 2011 15:49:02 +0000 (15:49 +0000)
src/include/gnunet_time_lib.h
src/testing/testing.c
src/util/time.c

index b1ffc4d40a55a2aa269bd8fadea181bc777c2dfc..386f6d6098219360fd09a96f389ce8f33a18be27 100644 (file)
@@ -421,6 +421,17 @@ struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh (struct
                                                        GNUNET_TIME_AbsoluteNBO
                                                        a);
 
+/**
+ * Convert a relative time to a string.
+ * NOT reentrant!
+ *
+ * @param time the time to print
+ *
+ * @return string form of the time (as milliseconds)
+ */
+const char *
+GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time);
+
 /**
  * Set the timestamp offset for this instance.
  *
index a079390ad8a65f4b3958b0591f28ec6257aeda25..a9734aea68a143aa2a35d92adfd9307d45f1e8f1 100644 (file)
@@ -576,7 +576,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 #if DEBUG_TESTING
                                              "-L", "DEBUG",
 #endif
-                                             "-s", "-q", NULL);
+                                             "-s", "-q", "-T", GNUNET_TIME_relative_to_string(GNUNET_TIME_absolute_get_remaining(d->max_timeout)), NULL);
         }
       else
         {
@@ -602,6 +602,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                                  "-L", "DEBUG",
 #endif
                                                  "-c", d->cfgfile, "-s", "-q",
+                                                 "-T", GNUNET_TIME_relative_to_string(GNUNET_TIME_absolute_get_remaining(d->max_timeout)),
                                                  NULL);
             }
           else
@@ -617,6 +618,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                                                  "-L", "DEBUG",
 #endif
                                                  "-c", d->cfgfile, "-s", "-q",
+                                                 "-T", GNUNET_TIME_relative_to_string(GNUNET_TIME_absolute_get_remaining(d->max_timeout)),
                                                  NULL);
             }
           GNUNET_free (dst);
@@ -1101,6 +1103,7 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-i", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Starting gnunet-arm with command ssh %s gnunet-arm -c %s -i %s -q\n",
@@ -1120,6 +1123,7 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-i", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
     }
 
@@ -1180,6 +1184,7 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-i", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Starting gnunet-arm with command ssh %s gnunet-arm -c %s -i %s -q\n",
@@ -1199,6 +1204,7 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-i", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
     }
 
@@ -1644,6 +1650,7 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-k", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Stopping gnunet-arm with command ssh %s gnunet-arm -c %s -k %s -q\n",
@@ -1663,6 +1670,7 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-k", service, "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          NULL);
     }
 
@@ -1781,6 +1789,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-e", "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          del_arg, NULL);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Stopping gnunet-arm with command ssh %s gnunet-arm -c %s -e -q %s\n",
@@ -1801,6 +1810,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
                                          "-L", "DEBUG",
 #endif
                                          "-c", d->cfgfile, "-e", "-q",
+                                         "-T", GNUNET_TIME_relative_to_string(timeout),
                                          del_arg, NULL);
     }
 
index 5ae05b0d7d80d38e8399a5a571b62da10c58696d..3631c0a7868cc6110a796193e55b36b391ca3874 100644 (file)
@@ -486,6 +486,25 @@ GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a)
 
 }
 
+/**
+ * Convert a relative time to a string.
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param time the time to print
+ *
+ * @return string form of the time (as milliseconds)
+ */
+const char *
+GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time)
+{
+  static char time_string[21];
+  memset(time_string, 0, sizeof(time_string));
+
+  sprintf(time_string, "%lu", time.rel_value);
+  return (const char *) time_string;
+}
+
 
 
 /* end of time.c */