mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-20 22:18:15 +00:00
settings: Use std::chrono::seconds instead of s64 for RTC
This commit is contained in:
parent
921ea45baf
commit
63e948f483
6 changed files with 21 additions and 17 deletions
|
@ -428,7 +428,8 @@ void Config::ReadValues() {
|
|||
|
||||
const auto custom_rtc_enabled = qt_config->value("custom_rtc_enabled", false).toBool();
|
||||
if (custom_rtc_enabled) {
|
||||
Settings::values.custom_rtc = qt_config->value("custom_rtc", 0).toULongLong();
|
||||
Settings::values.custom_rtc =
|
||||
std::chrono::seconds(qt_config->value("custom_rtc", 0).toULongLong());
|
||||
} else {
|
||||
Settings::values.custom_rtc = std::nullopt;
|
||||
}
|
||||
|
@ -661,7 +662,8 @@ void Config::SaveValues() {
|
|||
qt_config->setValue("rng_seed", Settings::values.rng_seed.value_or(0));
|
||||
|
||||
qt_config->setValue("custom_rtc_enabled", Settings::values.custom_rtc.has_value());
|
||||
qt_config->setValue("custom_rtc", Settings::values.custom_rtc.value_or(0));
|
||||
qt_config->setValue("custom_rtc",
|
||||
Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count());
|
||||
|
||||
qt_config->endGroup();
|
||||
|
||||
|
|
|
@ -77,8 +77,9 @@ void ConfigureSystem::setConfiguration() {
|
|||
ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value());
|
||||
ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value());
|
||||
|
||||
const auto rtc_time = Settings::values.custom_rtc.value_or(QDateTime::currentSecsSinceEpoch());
|
||||
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time));
|
||||
const auto rtc_time = Settings::values.custom_rtc.value_or(
|
||||
std::chrono::seconds(QDateTime::currentSecsSinceEpoch()));
|
||||
ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count()));
|
||||
}
|
||||
|
||||
void ConfigureSystem::ReadSystemSettings() {}
|
||||
|
@ -95,7 +96,8 @@ void ConfigureSystem::applyConfiguration() {
|
|||
Settings::values.rng_seed = std::nullopt;
|
||||
|
||||
if (ui->custom_rtc_checkbox->isChecked())
|
||||
Settings::values.custom_rtc = ui->custom_rtc_edit->dateTime().toSecsSinceEpoch();
|
||||
Settings::values.custom_rtc =
|
||||
std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch());
|
||||
else
|
||||
Settings::values.custom_rtc = std::nullopt;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue