]> git.stg.codes - stg.git/commitdiff
More stgTime cleanup.
authorMaksym Mamontov <madf@madf.info>
Mon, 28 Jun 2021 19:23:18 +0000 (22:23 +0300)
committerMaksym Mamontov <madf@madf.info>
Mon, 28 Jun 2021 19:23:18 +0000 (22:23 +0300)
CMakeLists.txt
include/stg/user_property.h
projects/stargazer/CMakeLists.txt
projects/stargazer/plugins/configuration/rpcconfig/user_helper.cpp
projects/stargazer/plugins/configuration/rpcconfig/users_methods.cpp

index 30deed57d12ebaafdce18794ca8880faebfd7179..100f9c00981a4a02e2e5949c9b4bd2ca585fccf5 100644 (file)
@@ -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}'" )
index 7c65f962d2f7f244db3b5013d55feaf92a47555d..5965a7a6d0cbd0e3f373846e13c7a5509cbede66 100644 (file)
@@ -22,8 +22,6 @@
 
 #include <unistd.h> // access
 
-extern volatile time_t stgTime;
-
 namespace STG
 {
 //-----------------------------------------------------------------------------
@@ -186,7 +184,7 @@ template <typename T>
 inline
 UserProperty<T>::UserProperty(T& val)
     : value(val),
-      modificationTime(stgTime),
+      modificationTime(time(NULL)),
       beforeNotifiers(),
       afterNotifiers()
 {
@@ -196,7 +194,7 @@ template <typename T>
 inline
 void UserProperty<T>::ModifyTime() noexcept
 {
-    modificationTime = stgTime;
+    modificationTime = time(NULL);
 }
 //-----------------------------------------------------------------------------
 template <typename T>
@@ -212,7 +210,7 @@ void UserProperty<T>::Set(const T& rvalue)
         (*ni++)->Notify(oldVal, rvalue);
 
     value = rvalue;
-    modificationTime = stgTime;
+    modificationTime = time(NULL);
 
     ni = afterNotifiers.begin();
     while (ni != afterNotifiers.end())
index 073c71652f4cf4bc73e3159e1d3938a0eb75eb7f..1670de26cbb1c82c3ff93ec419d1d1e4075286d0 100644 (file)
@@ -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 )
index 7a7a9b906fd349450dbea5c817f9233237885f6c..38e9a260ebd2b8783f5ef52791e65eeae4e75b0a 100644 (file)
@@ -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)
index 650f7b37d3a88274ae290a78727bf968f3a4e46c..71910620470f77cc32505ba690b804c4f1035900 100644 (file)
@@ -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))