Skip to content

Commit d331c3d

Browse files
committed
Fixed #15 renamed currentTime_milliseconds -> getCurrentTimeInMilliseconds, currentTime_seconds -> getCurrentTimeInSeconds, currentTime_forFilename -> getCurrentTimeForFilename, currentTime_logformat -> getCurrentTimeForLogFormat
1 parent 88ca764 commit d331c3d

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

src/wsjcpp_core.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,22 +367,29 @@ std::string WsjcppCore::getCurrentDirectory() {
367367

368368
// ---------------------------------------------------------------------
369369

370-
long WsjcppCore::currentTime_milliseconds() {
370+
long WsjcppCore::getCurrentTimeInMilliseconds() {
371371
long nTimeStart = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
372372
return nTimeStart;
373373
}
374374

375375
// ---------------------------------------------------------------------
376376

377-
long WsjcppCore::currentTime_seconds() {
377+
long WsjcppCore::getCurrentTimeInSeconds() {
378378
long nTimeStart = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();
379379
return nTimeStart;
380380
}
381381

382382
// ---------------------------------------------------------------------
383383

384-
std::string WsjcppCore::currentTime_logformat() {
385-
long nTimeStart = WsjcppCore::currentTime_milliseconds();
384+
std::string WsjcppCore::getCurrentTimeForFilename() {
385+
long nTimeStart = WsjcppCore::getCurrentTimeInSeconds();
386+
return WsjcppCore::formatTimeForFilename(nTimeStart);
387+
}
388+
389+
// ---------------------------------------------------------------------
390+
391+
std::string WsjcppCore::getCurrentTimeForLogFormat() {
392+
long nTimeStart = WsjcppCore::getCurrentTimeInMilliseconds();
386393
std::string sMilliseconds = std::to_string(int(nTimeStart % 1000));
387394
nTimeStart = nTimeStart / 1000;
388395

@@ -425,12 +432,7 @@ std::string WsjcppCore::formatTimeForWeb(long nTimeInSec) {
425432
return std::string(buf);
426433
}
427434

428-
// ---------------------------------------------------------------------
429435

430-
std::string WsjcppCore::currentTime_forFilename() {
431-
long nTimeStart = WsjcppCore::currentTime_seconds();
432-
return WsjcppCore::formatTimeForFilename(nTimeStart);
433-
}
434436

435437
// ---------------------------------------------------------------------
436438

@@ -1065,7 +1067,7 @@ WsjcppLogGlobalConf::WsjcppLogGlobalConf() {
10651067
// ---------------------------------------------------------------------
10661068

10671069
void WsjcppLogGlobalConf::doLogRotateUpdateFilename(bool bForce) {
1068-
long t = WsjcppCore::currentTime_seconds();
1070+
long t = WsjcppCore::getCurrentTimeInSeconds();
10691071
long nEverySeconds = logRotationPeriodInSeconds; // rotate log if started now or if time left more then 1 day
10701072
if (logStartTime == 0 || t - logStartTime > nEverySeconds || bForce) {
10711073
logStartTime = t;
@@ -1163,7 +1165,7 @@ void WsjcppLog::add(WsjcppColorModifier &clr, const std::string &sType, const st
11631165
std::lock_guard<std::mutex> lock(WsjcppLog::g_WSJCPP_LOG_GLOBAL_CONF.logMutex);
11641166
WsjcppColorModifier def(WsjcppColorCode::FG_DEFAULT);
11651167

1166-
std::string sLogMessage = WsjcppCore::currentTime_logformat() + ", " + WsjcppCore::getThreadId()
1168+
std::string sLogMessage = WsjcppCore::getCurrentTimeForLogFormat() + ", " + WsjcppCore::getThreadId()
11671169
+ " [" + sType + "] " + sTag + ": " + sMessage;
11681170
std::cout << clr << sLogMessage << def << std::endl;
11691171

src/wsjcpp_core.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ class WsjcppCore {
7474
static std::string extractFilename(const std::string &sPath);
7575
static std::string getCurrentDirectory();
7676

77-
static long currentTime_milliseconds();
78-
static long currentTime_seconds();
79-
static std::string currentTime_forFilename();
80-
static std::string currentTime_logformat();
77+
static long getCurrentTimeInMilliseconds();
78+
static long getCurrentTimeInSeconds();
79+
static std::string getCurrentTimeForFilename();
80+
static std::string getCurrentTimeForLogFormat();
8181
static std::string getThreadId();
8282
static std::string formatTimeForWeb(long nTimeInSec);
8383
static std::string formatTimeForFilename(long nTimeInSec);

src/wsjcpp_unit_tests_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main(int argc, char** argv) {
4141
}
4242
}
4343
if (nSuccess == nAll) {
44-
WsjcppLog::ok(TAG, "All unit-tests passed" + std::to_string(nSuccess) + " / " + std::to_string(nAll));
44+
WsjcppLog::ok(TAG, "All unit-tests passed " + std::to_string(nSuccess) + " / " + std::to_string(nAll));
4545
} else {
4646
WsjcppLog::warn(TAG, "Passed unit-tests " + std::to_string(nSuccess) + " / " + std::to_string(nAll));
4747
WsjcppLog::err(TAG, std::to_string(nAll - nSuccess) + " unit-test(s) failed.");

0 commit comments

Comments
 (0)