aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/chillout/common
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:31:18 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:31:18 -0400
commit4de57f628bc74f00ba1885e91c84ea07c5405d8f (patch)
tree5d91900751e826d491ff1b2ebc571a787e84f864 /SQLiteStudio3/coreSQLiteStudio/chillout/common
parent74d881cefa9097e58e129e37b9c44d680d8c7dfe (diff)
parent3565aad630864ecdbe53fdaa501ea708555b3c7c (diff)
Update upstream source from tag 'upstream/3.4.4+dfsg'
Update to upstream version '3.4.4+dfsg' with Debian dir 482614bd23f0ef52dabc9803477204ad88e917ed
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/chillout/common')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/chillout/common/common.cpp24
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/chillout/common/common.h24
2 files changed, 48 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.cpp b/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.cpp
new file mode 100644
index 0000000..2f51fc1
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.cpp
@@ -0,0 +1,24 @@
+#include "common.h"
+#include <ctime>
+#include <locale>
+#include <cstring>
+
+namespace Debug {
+ tm now() {
+ time_t now = time(0);
+ return *localtime(&now);
+ }
+
+#ifdef _WIN32
+ std::wostream& formatDateTime(std::wostream& out, const tm& t, const wchar_t* fmt) {
+ const std::time_put<wchar_t>& dateWriter = std::use_facet<std::time_put<wchar_t> >(out.getloc());
+ const size_t n = wcslen(fmt);
+#else
+ std::ostream& formatDateTime(std::ostream& out, const tm& t, const char* fmt) {
+ const std::time_put<char>& dateWriter = std::use_facet<std::time_put<char> >(out.getloc());
+ const size_t n = strlen(fmt);
+#endif
+ dateWriter.put(out, out, ' ', &t, fmt, fmt + n);
+ return out;
+ }
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.h b/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.h
new file mode 100644
index 0000000..85b479a
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/chillout/common/common.h
@@ -0,0 +1,24 @@
+#ifndef COMMON_H
+#define COMMON_H
+
+#include <ctime>
+#include <ostream>
+
+#define CHILLOUT_DATETIME "%Y%m%d_%H%M%S"
+
+namespace Debug {
+ tm now();
+#ifdef _WIN32
+ std::wostream& formatDateTime(std::wostream& out, const tm& t, const wchar_t *fmt);
+#else
+ std::ostream& formatDateTime(std::ostream& out, const tm& t, const char* fmt);
+#endif
+
+ enum CrashDumpSize {
+ CrashDumpSmall,
+ CrashDumpNormal,
+ CrashDumpFull
+ };
+}
+
+#endif // COMMON_H