1
0
mirror of synced 2024-11-28 17:40:51 +01:00

Fixed compile on Linux

This commit is contained in:
WerWolv 2020-11-21 00:36:38 +01:00
parent bf6ed3d540
commit e3b6cfd54f
2 changed files with 17 additions and 2 deletions

View File

@ -31,8 +31,12 @@ namespace hex {
u8 utf8Char[4]; u8 utf8Char[4];
float float32; float float32;
double float64; double float64;
#if defined(_WIN64)
__time32_t time32; __time32_t time32;
__time64_t time64; __time64_t time64;
#else
time_t time;
#endif
GUID guid; GUID guid;
}; };

View File

@ -63,6 +63,7 @@ namespace hex {
this->m_cachedData.emplace_back("float (32 bit)", hex::format("%e", this->m_previewData.float32)); this->m_cachedData.emplace_back("float (32 bit)", hex::format("%e", this->m_previewData.float32));
this->m_cachedData.emplace_back("double (64 bit)", hex::format("%e", this->m_previewData.float64)); this->m_cachedData.emplace_back("double (64 bit)", hex::format("%e", this->m_previewData.float64));
#if defined(_WIN64)
{ {
std::tm * ptm = _localtime32(&this->m_previewData.time32); std::tm * ptm = _localtime32(&this->m_previewData.time32);
char buffer[32]; char buffer[32];
@ -80,6 +81,16 @@ namespace hex {
else else
this->m_cachedData.emplace_back("__time64_t", "Invalid"); this->m_cachedData.emplace_back("__time64_t", "Invalid");
} }
#else
{
std::tm * ptm = localtime(&this->m_previewData.time);
char buffer[64];
if (std::strftime(buffer, 64, "%a, %d.%m.%Y %H:%M:%S", ptm) != 0)
this->m_cachedData.emplace_back("time_t", buffer);
else
this->m_cachedData.emplace_back("time_t", "Invalid");
}
#endif
this->m_cachedData.emplace_back("GUID", hex::format("{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}", this->m_cachedData.emplace_back("GUID", hex::format("{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}",
this->m_previewData.guid.data1, this->m_previewData.guid.data2, this->m_previewData.guid.data3, this->m_previewData.guid.data1, this->m_previewData.guid.data2, this->m_previewData.guid.data3,