Skip to content

Commit 2f29d79

Browse files
committed
Hopefully fix build
1 parent bc69c68 commit 2f29d79

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Menus/SaveLoadMenuGUI.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,18 @@ namespace RTE {
149149
saveNameText << std::left << std::setfill(' ') << std::setw(32) << save.SavePath.stem().string();
150150

151151
// This is so much more fucking difficult than it has any right to be
152+
#if __cpp_lib_chrono >= 201907L
152153
const auto saveFsTime = std::chrono::clock_cast<std::chrono::system_clock>(save.SaveDate);
153154
const auto saveTime = std::chrono::system_clock::to_time_t(saveFsTime);
155+
#else
156+
// TODO - kill this monstrosity when we move to GCC13
157+
auto saveFsTime = std::chrono::system_clock::time_point(save.SaveDate.time_since_epoch());
158+
#ifdef _WIN32
159+
// Windows epoch time are the number of seconds since... 1601-01-01 00:00:00. Seriously.
160+
saveFsTime -= std::chrono::seconds(11644473600LL);
161+
#endif
162+
const auto saveTime = std::chrono::system_clock::to_time_t(saveFsTime);
163+
#endif
154164
const auto saveTimeLocal = std::localtime(&saveTime);
155165

156166
std::stringstream saveDateTimeText;

0 commit comments

Comments
 (0)