diff --git a/lib/external/pattern_language b/lib/external/pattern_language index f73ac03e3..a59aa47b9 160000 --- a/lib/external/pattern_language +++ b/lib/external/pattern_language @@ -1 +1 @@ -Subproject commit f73ac03e3df7cebc145e8f0f7af12c3873a77219 +Subproject commit a59aa47b9d677ef978892bf2cccb6536cdaba742 diff --git a/lib/libimhex/source/helpers/logger.cpp b/lib/libimhex/source/helpers/logger.cpp index 46caa5b68..797fc4181 100644 --- a/lib/libimhex/source/helpers/logger.cpp +++ b/lib/libimhex/source/helpers/logger.cpp @@ -83,7 +83,8 @@ namespace hex::log { for (const auto &path : paths::Logs.all()) { wolv::io::fs::createDirectories(path); - s_loggerFile = wolv::io::File(path / hex::format("{0:%Y%m%d_%H%M%S}.log", fmt::localtime(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()))), wolv::io::File::Mode::Create); + time_t time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + s_loggerFile = wolv::io::File(path / hex::format("{0:%Y%m%d_%H%M%S}.log", *std::localtime(&time)), wolv::io::File::Mode::Create); s_loggerFile.disableBuffering(); if (s_loggerFile.isValid()) { @@ -120,7 +121,8 @@ namespace hex::log { void printPrefix(FILE *dest, const fmt::text_style &ts, const std::string &level, const char *projectName) { - const auto now = fmt::localtime(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())); + const auto time = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + const auto now = *std::localtime(&time); fmt::print(dest, "[{0:%H:%M:%S}] ", now); diff --git a/lib/third_party/fmt b/lib/third_party/fmt index 9cf9f38ed..40626af88 160000 --- a/lib/third_party/fmt +++ b/lib/third_party/fmt @@ -1 +1 @@ -Subproject commit 9cf9f38eded63e5e0fb95cd536ba51be601d7fa2 +Subproject commit 40626af88bd7df9a5fb80be7b25ac85b122d6c21 diff --git a/main/gui/source/init/splash_window.cpp b/main/gui/source/init/splash_window.cpp index ffec4b44a..eb69fc945 100644 --- a/main/gui/source/init/splash_window.cpp +++ b/main/gui/source/init/splash_window.cpp @@ -111,7 +111,7 @@ namespace hex::init { const auto now = std::chrono::system_clock::now(); const auto time = std::chrono::system_clock::to_time_t(now); - return fmt::localtime(time); + return *std::localtime(&time); }(); for (const auto &colorConfig : highlightConfig) { diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index f4b2b5af5..470f738d7 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -621,11 +621,11 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) { std::ignore = style; - auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); + time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); } catch (fmt::format_error &) { value = "Invalid"; } @@ -636,11 +636,11 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.time64", sizeof(u64), [](auto buffer, auto endian, auto style) { std::ignore = style; - auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); + time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); } catch (fmt::format_error &) { value = "Invalid"; } @@ -653,11 +653,11 @@ namespace hex::plugin::builtin { ContentRegistry::DataInspector::add("hex.builtin.inspector.time", sizeof(time_t), [](auto buffer, auto endian, auto style) { std::ignore = style; - auto endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); + time_t endianAdjustedTime = hex::changeEndianness(*reinterpret_cast(buffer.data()), endian); std::string value; try { - value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", fmt::localtime(endianAdjustedTime)); + value = hex::format("{0:%a, %d.%m.%Y %H:%M:%S}", *std::localtime(&endianAdjustedTime)); } catch (fmt::format_error &e) { value = "Invalid"; } diff --git a/plugins/builtin/source/content/providers/file_provider.cpp b/plugins/builtin/source/content/providers/file_provider.cpp index c53a9a263..e2dde4fa4 100644 --- a/plugins/builtin/source/content/providers/file_provider.cpp +++ b/plugins/builtin/source/content/providers/file_provider.cpp @@ -135,14 +135,14 @@ namespace hex::plugin::builtin { if (m_fileStats.has_value()) { std::string creationTime, accessTime, modificationTime; - try { creationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_ctime)); } - catch (const std::exception&) { creationTime = "???"; } + try { creationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_ctime)); } + catch (const fmt::format_error&) { creationTime = "???"; } - try { accessTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_atime)); } - catch (const std::exception&) { accessTime = "???"; } + try { accessTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_atime)); } + catch (const fmt::format_error&) { accessTime = "???"; } - try { modificationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", fmt::localtime(m_fileStats->st_mtime)); } - catch (const std::exception&) { modificationTime = "???"; } + try { modificationTime = hex::format("{:%Y-%m-%d %H:%M:%S}", *std::localtime(&m_fileStats->st_mtime)); } + catch (const fmt::format_error&) { modificationTime = "???"; } result.emplace_back("hex.builtin.provider.file.creation"_lang, creationTime); result.emplace_back("hex.builtin.provider.file.access"_lang, accessTime);