mirror of https://github.com/WerWolv/ImHex.git
Fixed time_t decoding crash on Linux
This commit is contained in:
parent
cea366e135
commit
f0eba69c4a
|
@ -72,7 +72,7 @@ namespace hex {
|
||||||
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time32, this->m_endianess);
|
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time32, this->m_endianess);
|
||||||
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
std::tm * ptm = _localtime32(&endianAdjustedTime);
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
if (std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm))
|
if (ptm != nullptr && std::strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm))
|
||||||
this->m_cachedData.emplace_back("__time32_t", buffer);
|
this->m_cachedData.emplace_back("__time32_t", buffer);
|
||||||
else
|
else
|
||||||
this->m_cachedData.emplace_back("__time32_t", "Invalid");
|
this->m_cachedData.emplace_back("__time32_t", "Invalid");
|
||||||
|
@ -82,7 +82,7 @@ namespace hex {
|
||||||
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time64, this->m_endianess);
|
auto endianAdjustedTime = hex::changeEndianess(this->m_previewData.time64, this->m_endianess);
|
||||||
std::tm * ptm = _localtime64(&endianAdjustedTime);
|
std::tm * ptm = _localtime64(&endianAdjustedTime);
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
if (std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0)
|
if (ptm != nullptr && std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0)
|
||||||
this->m_cachedData.emplace_back("__time64_t", buffer);
|
this->m_cachedData.emplace_back("__time64_t", buffer);
|
||||||
else
|
else
|
||||||
this->m_cachedData.emplace_back("__time64_t", "Invalid");
|
this->m_cachedData.emplace_back("__time64_t", "Invalid");
|
||||||
|
|
Loading…
Reference in New Issue