diff options
| author | 2023-04-30 18:30:36 -0400 | |
|---|---|---|
| committer | 2023-04-30 18:30:36 -0400 | |
| commit | 3565aad630864ecdbe53fdaa501ea708555b3c7c (patch) | |
| tree | c743e4ad0bad39ebdb2f514c7cc52d34a257ebbe /SQLiteStudio3/coreSQLiteStudio/chillout/common | |
| parent | 1fdc150116cad39aae5c5da407c3312b47a59e3a (diff) | |
New upstream version 3.4.4+dfsg.upstream/3.4.4+dfsg
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/chillout/common')
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/chillout/common/common.cpp | 24 | ||||
| -rw-r--r-- | SQLiteStudio3/coreSQLiteStudio/chillout/common/common.h | 24 |
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 |
