diff options
| author | Scott Mansell <phiren@gmail.com> | 2016-09-07 14:05:58 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-07 14:05:58 +1200 |
| commit | f5e870bbe5be300f36f87a2f5dacbbc235978146 (patch) | |
| tree | e70f8cb1a037ef656742bb09aecb8cb068ed3e32 /Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp | |
| parent | 366a38a91732dc6a5a9b3e0352ab7a73c9c7ff38 (diff) | |
| parent | a3eb9082fce0d5bae20b89ea943fa0a8d57c77fe (diff) | |
Merge pull request #4135 from RisingFog/remove_wii_limits_rtc
Fix issues with Custom RTC when set past the year 2038
Diffstat (limited to 'Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp b/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp index b24f81036a..4f9934fc39 100644 --- a/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp +++ b/Source/Core/DolphinWX/Config/AdvancedConfigPane.cpp @@ -137,6 +137,11 @@ void AdvancedConfigPane::OnClockOverrideSliderChanged(wxCommandEvent& event) UpdateCPUClock(); } +u32 ToSeconds(wxDateTime date) +{ + return static_cast<u32>(date.GetValue().GetValue() / 1000); +} + void AdvancedConfigPane::OnCustomRTCCheckBoxChanged(wxCommandEvent& event) { const bool checked = m_custom_rtc_checkbox->IsChecked(); @@ -147,13 +152,13 @@ void AdvancedConfigPane::OnCustomRTCCheckBoxChanged(wxCommandEvent& event) void AdvancedConfigPane::OnCustomRTCDateChanged(wxCommandEvent& event) { - m_temp_date = m_custom_rtc_date_picker->GetValue().GetTicks(); + m_temp_date = ToSeconds(m_custom_rtc_date_picker->GetValue()); UpdateCustomRTC(m_temp_date, m_temp_time); } void AdvancedConfigPane::OnCustomRTCTimeChanged(wxCommandEvent& event) { - m_temp_time = m_custom_rtc_time_picker->GetValue().GetTicks() - m_temp_date; + m_temp_time = ToSeconds(m_custom_rtc_time_picker->GetValue()) - m_temp_date; UpdateCustomRTC(m_temp_date, m_temp_time); } @@ -178,15 +183,11 @@ void AdvancedConfigPane::LoadCustomRTC() m_custom_rtc_date_picker->SetValue(custom_rtc); m_custom_rtc_time_picker->SetValue(custom_rtc); } - m_temp_date = m_custom_rtc_date_picker->GetValue().GetTicks(); - m_temp_time = m_custom_rtc_time_picker->GetValue().GetTicks() - m_temp_date; - // Limit dates to valid ranges (2000 to 2099 for GC, 2000 to 2035 for Wii) - if (SConfig::GetInstance().bWii) - m_custom_rtc_date_picker->SetRange(wxDateTime(1, wxDateTime::Jan, 2000), - wxDateTime(31, wxDateTime::Dec, 2035)); - else - m_custom_rtc_date_picker->SetRange(wxDateTime(1, wxDateTime::Jan, 2000), - wxDateTime(31, wxDateTime::Dec, 2099)); + m_temp_date = ToSeconds(m_custom_rtc_date_picker->GetValue()); + m_temp_time = ToSeconds(m_custom_rtc_time_picker->GetValue()) - m_temp_date; + // Limit dates to a valid range (Jan 1/2000 to Dec 31/2099) + m_custom_rtc_date_picker->SetRange(wxDateTime(1, wxDateTime::Jan, 2000), + wxDateTime(31, wxDateTime::Dec, 2099)); if (Core::IsRunning()) { m_custom_rtc_checkbox->Enable(false); @@ -203,7 +204,7 @@ void AdvancedConfigPane::LoadCustomRTC() void AdvancedConfigPane::UpdateCustomRTC(time_t date, time_t time) { wxDateTime custom_rtc(date + time); - SConfig::GetInstance().m_customRTCValue = custom_rtc.FromUTC().GetTicks(); + SConfig::GetInstance().m_customRTCValue = ToSeconds(custom_rtc.FromUTC()); m_custom_rtc_date_picker->SetValue(custom_rtc); m_custom_rtc_time_picker->SetValue(custom_rtc); } |
