X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/43ac308ea20014761481bc40525496a0bb1d9740..16e9905f82947dd471c09382122d8150ba6fda1a:/projects/stargazer/traffcounter_impl.cpp diff --git a/projects/stargazer/traffcounter_impl.cpp b/projects/stargazer/traffcounter_impl.cpp index a4227497..f983d6af 100644 --- a/projects/stargazer/traffcounter_impl.cpp +++ b/projects/stargazer/traffcounter_impl.cpp @@ -28,25 +28,25 @@ $Author: faust $ */ -/* inet_aton */ -#include -#include -#include -#include - -#include -#include -#include // fopen and similar -#include // strtol - #include "stg/common.h" -#include "stg/locker.h" #include "stg/const.h" // MONITOR_TIME_DELAY_SEC #include "traffcounter_impl.h" #include "stg_timer.h" #include "users_impl.h" #include "async_pool.h" +#include +#include +#include +#include // fopen and similar +#include // strtol + +/* inet_aton */ +#include +#include +#include +#include + #define FLUSH_TIME (10) #define REMOVE_TIME (31) @@ -128,9 +128,8 @@ assert(h && "USERS::OpenSearch is always correct"); m_onIPConns.clear(); //5 seconds to thread stops itself -struct timespec ts = {0, 200000000}; for (int i = 0; i < 25 && !stopped; i++) - nanosleep(&ts, NULL); + std::this_thread::sleep_for(std::chrono::milliseconds(200)); if (!stopped) { @@ -155,10 +154,9 @@ stopped = false; int c = 0; time_t touchTime = stgTime - MONITOR_TIME_DELAY_SEC; -struct timespec ts = {0, 500000000}; while (!token.stop_requested()) { - nanosleep(&ts, 0); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); if (token.stop_requested()) { FlushAndRemove();