Replace std::time with std::chrono::system_clock

This commit is contained in:
vabold 2022-11-12 04:03:38 -05:00
parent ff1c71cc38
commit 083b8172e0
2 changed files with 7 additions and 2 deletions

View File

@ -241,7 +241,10 @@ IPCReply DolphinDevice::GetSystemTime(const IOCtlVRequest& request) const
return IPCReply(IPC_EINVAL); return IPCReply(IPC_EINVAL);
} }
const u64 milliseconds = std::time(nullptr); // Write Unix timestamp in milliseconds to memory address
const u64 milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
Memory::Write_U64(milliseconds, request.io_vectors[0].address); Memory::Write_U64(milliseconds, request.io_vectors[0].address);
return IPCReply(IPC_SUCCESS); return IPCReply(IPC_SUCCESS);
} }

View File

@ -290,7 +290,9 @@ void UpdateDiscordPresence(int party_size, SecretType type, const std::string& s
discord_presence.smallImageText = "Dolphin is an emulator for the GameCube and the Wii."; discord_presence.smallImageText = "Dolphin is an emulator for the GameCube and the Wii.";
} }
discord_presence.details = title.empty() ? "Not in-game" : title.c_str(); discord_presence.details = title.empty() ? "Not in-game" : title.c_str();
discord_presence.startTimestamp = std::time(nullptr); discord_presence.startTimestamp = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
if (party_size > 0) if (party_size > 0)
{ {