From 263c722a40d282b0fab3f3cccd70a3eddd2915c7 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Wed, 18 Dec 2024 20:59:27 +0100 Subject: [PATCH] [XAM] Added X_ACHIEVEMENT_UNLOCK_TIME ctor to support unix timestamp --- src/xenia/kernel/xam/achievement_manager.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/xenia/kernel/xam/achievement_manager.h b/src/xenia/kernel/xam/achievement_manager.h index 0efd18814..bd04d524b 100644 --- a/src/xenia/kernel/xam/achievement_manager.h +++ b/src/xenia/kernel/xam/achievement_manager.h @@ -65,6 +65,15 @@ struct X_ACHIEVEMENT_UNLOCK_TIME { low_part = static_cast(filetime); } + X_ACHIEVEMENT_UNLOCK_TIME(std::time_t time) { + const auto file_time = + chrono::WinSystemClock::to_file_time(chrono::WinSystemClock::from_sys( + std::chrono::system_clock::from_time_t(time))); + + high_part = static_cast(file_time >> 32); + low_part = static_cast(file_time); + } + chrono::WinSystemClock::time_point to_time_point() const { const uint64_t filetime = (static_cast(high_part) << 32) | low_part;