X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/ede91934442fd804d7b818971a44e3ad795cb01f..f5bfdf06e2e8f2e6f479cc6b477a6c7c4a69f965:/projects/stargazer/traffcounter.cpp?ds=inline diff --git a/projects/stargazer/traffcounter.cpp b/projects/stargazer/traffcounter.cpp index 9697cde0..dd672f37 100644 --- a/projects/stargazer/traffcounter.cpp +++ b/projects/stargazer/traffcounter.cpp @@ -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();