]> git.stg.codes - stg.git/blobdiff - projects/stargazer/traffcounter.cpp
Change some usleep() to nanosleep() `cause usleep() is obsolete since
[stg.git] / projects / stargazer / traffcounter.cpp
index 9697cde055b9b84b01ce0f3ba6bebf4f14e92bc4..dd672f3733c0ae128f8145b1031fc132c01a3d0b 100644 (file)
@@ -139,9 +139,10 @@ while (users->SearchNext(h, &u) == 0)
 users->CloseSearch(h);
 
 //5 seconds to thread stops itself
+struct timespec ts = {0, 200000000};
 for (int i = 0; i < 25 && !stopped; i++)
     {
-    usleep(200000);
+    nanosleep(&ts, NULL);
     }
 
 //after 5 seconds waiting thread still running. now kill it
@@ -166,10 +167,10 @@ tc->stopped = false;
 int c = 0;
 
 time_t touchTime = stgTime - MONITOR_TIME_DELAY_SEC;
-
+struct timespec ts = {0, 500000000};
 while (tc->running)
     {
-    usleep(500000);
+    nanosleep(&ts, 0);
     if (!tc->running)
         {
         tc->FlushAndRemove();