|
@@ -154,6 +154,9 @@ static void route_test(NetIO &netio, char **args)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // The epoch interval, in microseconds
|
|
|
+ uint32_t epoch_interval_us = 1000000;
|
|
|
+
|
|
|
// Run 10 epochs
|
|
|
for (int i=0; i<10; ++i) {
|
|
|
struct timespec tp;
|
|
@@ -164,6 +167,10 @@ static void route_test(NetIO &netio, char **args)
|
|
|
unsigned long end = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
unsigned long diff = end - start;
|
|
|
printf("Epoch time: %lu.%06lu s\n", diff/1000000, diff%1000000);
|
|
|
+ // Sleep for the rest of the epoch interval
|
|
|
+ if (diff < epoch_interval_us) {
|
|
|
+ usleep(epoch_interval_us - (useconds_t)diff);
|
|
|
+ }
|
|
|
}
|
|
|
netio.close();
|
|
|
}
|