]> git.stg.codes - stg.git/blobdiff - projects/stargazer/user_impl.cpp
Use std::jthread and C++17.
[stg.git] / projects / stargazer / user_impl.cpp
index 2b7cc3a9d750187d32770d9d85112847be0d1495..f5f4c4b4bcf4c47b8a93a90883fcd213dd00d7e7 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <algorithm>
 #include <functional>
+#include <array>
 
 #include <cassert>
 #include <cstdlib>
@@ -641,7 +642,7 @@ void UserImpl::Run()
 {
 STG_LOCKER lock(&mutex);
 
-if (stgTime > static_cast<time_t>(lastWriteStat + settings->GetStatWritePeriod()))
+if (stgTime > lastWriteStat + settings->GetStatWritePeriod())
     {
     printfd(__FILE__, "UserImpl::WriteStat user=%s\n", GetLogin().c_str());
     WriteStat();
@@ -1046,8 +1047,7 @@ double UserImpl::GetPassiveTimePart() const
 {
 STG_LOCKER lock(&mutex);
 
-static int daysInMonth[12] =
-{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+static const std::array<unsigned, 12> daysInMonth{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
 struct tm tms;
 time_t t = stgTime;