From: Maksym Mamontov Date: Mon, 28 Jun 2021 19:23:18 +0000 (+0300) Subject: More stgTime cleanup. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/a5cb4cf37e5dfa9bb9ce5c5e4ccf8d5978d3576f?hp=8e80bb9cec2c90dd61f810fb1525932a434288eb More stgTime cleanup. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 30deed57..100f9c00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,7 @@ if ( BUILD_MOD_STORE_FIREBIRD OR BUILD_ALL_LIBS ) endif ( BUILD_MOD_STORE_FIREBIRD OR BUILD_ALL_LIBS ) if ( BUILD_MOD_PING OR BUILD_ALL_LIBS ) - set ( BUILD_LIB_PINGER ON ) + set ( BUILD_LIB_PINGER ON ) endif ( BUILD_MOD_PING OR BUILD_ALL_LIBS ) if ( BUILD_MOD_SMUX OR BUILD_ALL_LIBS ) @@ -134,7 +134,7 @@ elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" ) elseif ( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" ) add_definitions ( -DDARWIN ) if ( BUILD_LIB_IBPP ) - add_definitions ( -DIBPP_DARWIN ) + add_definitions ( -DIBPP_DARWIN ) endif ( BUILD_LIB_IBPP ) else () message ( WARNING "Unsupported system: '${CMAKE_SYSTEM_NAME}'" ) diff --git a/include/stg/user_property.h b/include/stg/user_property.h index 7c65f962..5965a7a6 100644 --- a/include/stg/user_property.h +++ b/include/stg/user_property.h @@ -22,8 +22,6 @@ #include // access -extern volatile time_t stgTime; - namespace STG { //----------------------------------------------------------------------------- @@ -186,7 +184,7 @@ template inline UserProperty::UserProperty(T& val) : value(val), - modificationTime(stgTime), + modificationTime(time(NULL)), beforeNotifiers(), afterNotifiers() { @@ -196,7 +194,7 @@ template inline void UserProperty::ModifyTime() noexcept { - modificationTime = stgTime; + modificationTime = time(NULL); } //----------------------------------------------------------------------------- template @@ -212,7 +210,7 @@ void UserProperty::Set(const T& rvalue) (*ni++)->Notify(oldVal, rvalue); value = rvalue; - modificationTime = stgTime; + modificationTime = time(NULL); ni = afterNotifiers.begin(); while (ni != afterNotifiers.end()) diff --git a/projects/stargazer/CMakeLists.txt b/projects/stargazer/CMakeLists.txt index 073c7165..1670de26 100644 --- a/projects/stargazer/CMakeLists.txt +++ b/projects/stargazer/CMakeLists.txt @@ -12,6 +12,7 @@ set ( CPP_FILES main.cpp plugin_mgr.cpp settings_impl.cpp stg_timer.cpp + timer_impl.cpp store_loader.cpp traffcounter_impl.cpp user_property.cpp ) diff --git a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp index 7a7a9b90..38e9a260 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp @@ -375,7 +375,7 @@ if ((it = structVal.find("tariff")) != structVal.end()) if (newTariff) { const auto currentTariff = ptr->GetTariff(); - std::string message = currentTariff->TariffChangeIsAllowed(*newTariff, stgTime); + std::string message = currentTariff->TariffChangeIsAllowed(*newTariff, time(NULL)); if (message.empty()) { if (ptr->GetProperties().tariffName.Get() != tariff) diff --git a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp index 650f7b37..71910620 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp +++ b/projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp @@ -384,7 +384,7 @@ if (tariffs->FindByName(tariff)) if (newTariff) { const auto currentTariff = u->GetTariff(); - std::string message = currentTariff->TariffChangeIsAllowed(*newTariff, stgTime); + std::string message = currentTariff->TariffChangeIsAllowed(*newTariff, time(NULL)); if (message.empty()) { if (u->GetProperties().tariffName.Set(tariff, *admin, login, *store, comment))