瀏覽代碼

More sleep timing touchups

Ian Goldberg 1 年之前
父節點
當前提交
2f6d22da17
共有 1 個文件被更改,包括 3 次插入5 次删除
  1. 3 5
      App/start.cpp

+ 3 - 5
App/start.cpp

@@ -276,8 +276,8 @@ static void route_clients_test(NetIO &netio)
         unsigned long end = epoch_clients(netio);
 
         clock_gettime(CLOCK_REALTIME_COARSE, &tp);
-        //unsigned long end_post_pc = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
-        //unsigned long diff_post_pc = end_post_pc - start;
+        unsigned long end_post_pc = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
+        unsigned long diff_post_pc = end_post_pc - end;
         //printf("Epoch end_post_pc time = %lu\n", end_post_pc);
         //printf("Epoch diff_post_pc time = %lu\n", diff_post_pc);
 
@@ -288,9 +288,7 @@ static void route_clients_test(NetIO &netio)
 
         struct timeval now;
         gettimeofday(&now, NULL);
-        remaining_us = epoch_interval
-            - (now.tv_sec - epoch_start.tv_sec) * 1000000
-            - (now.tv_usec - epoch_start.tv_usec);
+        remaining_us = epoch_interval - diff_post_pc;
 
         // Sleep for the rest of the epoch interval
         printf("%lu.%06lu: Sleeping for %ld us\n", now.tv_sec,