aboutsummaryrefslogtreecommitdiff
path: root/core/src/UI/UI_DatabaseView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/UI/UI_DatabaseView.cpp')
-rw-r--r--core/src/UI/UI_DatabaseView.cpp18
1 files changed, 13 insertions, 5 deletions
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 <IconsFontAwesome.h>
#include <SQLiteCpp/Statement.h>
#include <imgui.h>
+#include <chrono>
#include <cstdint>
#include <ctime>
#include <memory>
@@ -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<time_t>(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<chrono::system_clock> 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");