mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-03-12 22:56:52 +01:00
Merge pull request #10956 from Dentomologist/address_cpp20_todo_comments
Address c++20 TODO comments
This commit is contained in:
commit
9c9962083d
@ -178,11 +178,7 @@ void CEXIMemoryCard::SetupGciFolder(const Memcard::HeaderData& header_data)
|
|||||||
current_game_id = Common::swap32(reinterpret_cast<const u8*>(game_id.c_str()));
|
current_game_id = Common::swap32(reinterpret_cast<const u8*>(game_id.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(C++20): Use structured bindings when we can use C++20 and refer to structured bindings
|
const auto [dir_path, migrate] = GetGCIFolderPath(m_card_slot, AllowMovieFolder::Yes);
|
||||||
// in lambda captures
|
|
||||||
const auto folder_path_pair = GetGCIFolderPath(m_card_slot, AllowMovieFolder::Yes);
|
|
||||||
const std::string& dir_path = folder_path_pair.first;
|
|
||||||
const bool migrate = folder_path_pair.second;
|
|
||||||
|
|
||||||
const File::FileInfo file_info(dir_path);
|
const File::FileInfo file_info(dir_path);
|
||||||
if (!file_info.Exists())
|
if (!file_info.Exists())
|
||||||
|
@ -276,14 +276,7 @@ static constexpr int DOUBLE_TIME_OFFSET = (38 * 365 * 24 * 60 * 60);
|
|||||||
|
|
||||||
static double GetSystemTimeAsDouble()
|
static double GetSystemTimeAsDouble()
|
||||||
{
|
{
|
||||||
// FYI: std::chrono::system_clock epoch is not required to be 1970 until c++20.
|
const auto since_epoch = std::chrono::system_clock::now().time_since_epoch();
|
||||||
// We will however assume time_t IS unix time.
|
|
||||||
using Clock = std::chrono::system_clock;
|
|
||||||
|
|
||||||
// TODO: Use this on switch to c++20:
|
|
||||||
// const auto since_epoch = Clock::now().time_since_epoch();
|
|
||||||
const auto unix_epoch = Clock::from_time_t({});
|
|
||||||
const auto since_epoch = Clock::now() - unix_epoch;
|
|
||||||
|
|
||||||
const auto since_double_time_epoch = since_epoch - std::chrono::seconds(DOUBLE_TIME_OFFSET);
|
const auto since_double_time_epoch = since_epoch - std::chrono::seconds(DOUBLE_TIME_OFFSET);
|
||||||
return std::chrono::duration_cast<std::chrono::duration<double>>(since_double_time_epoch).count();
|
return std::chrono::duration_cast<std::chrono::duration<double>>(since_double_time_epoch).count();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user