From 80d8ae5a6fef6c9a34e81e240539cb655dd99851 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Wed, 14 Apr 2021 15:09:13 -0700 Subject: Initial work on workflows --- core/src/UI/UI_DatabaseView.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'core/src/UI/UI_DatabaseView.cpp') diff --git a/core/src/UI/UI_DatabaseView.cpp b/core/src/UI/UI_DatabaseView.cpp index 8791c5b..884ab51 100644 --- a/core/src/UI/UI_DatabaseView.cpp +++ b/core/src/UI/UI_DatabaseView.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -196,7 +197,7 @@ private: void UpdateLastPage() { mLastPage = mActiveEntries.empty() - ? 0 + ? 0 // TODO calc page : CalcPageForRowId(mActiveEntries.back()); } @@ -258,10 +259,17 @@ private: return ""; } - auto t = static_cast(epoch); - std::string str(29, '\0'); - std::strftime(str.data(), 21, "%Y-%m-%dT%H:%M:%S.", std::localtime(&t)); - return str; + namespace chrono = std::chrono; + using Clock = chrono::system_clock; + + chrono::milliseconds d{ epoch }; + chrono::time_point tp{ d }; + auto t = chrono::system_clock::to_time_t(tp); + + char data[32]; + std::strftime(data, sizeof(data), "%Y-%m-%d %H:%M:%S", std::localtime(&t)); + + return std::string(data); }; int customerCol = stmt.getColumnIndex("Customer"); -- cgit v1.2.3-70-g09d2