Skip to content

Commit 9c59e8f

Browse files
RTC: Automatically detect timezone
1 parent 8fb2940 commit 9c59e8f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pcsx2-qt/Settings/EmulationSettingsWidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ EmulationSettingsWidget::EmulationSettingsWidget(SettingsWindow* settings_dialog
159159
dialog()->registerWidgetHelp(m_ui.manuallySetRealTimeClock, tr("Manually Set Real-Time Clock"), tr("Unchecked"),
160160
tr("Manually set a real-time clock to use for the virtual PlayStation 2 instead of using your OS' system clock."));
161161
dialog()->registerWidgetHelp(m_ui.rtcDateTime, tr("Real-Time Clock"), tr("Current date and time"),
162-
tr("Real-time clock (RTC) used by the virtual PlayStation 2. Date format is the same as the one used by your OS. "
163-
"This time is only applied upon booting the PS2; changing it while in-game will have no effect. "
164-
"NOTE: This assumes you have your PS2 set to the default timezone of GMT+0 and default DST of Summer Time. "
162+
tr("Real-time clock (RTC) used by the virtual PlayStation 2. Date format is the same as the one used by your OS.<br>"
163+
"This time is only applied upon booting the PS2; changing it while in-game will have no effect.<br>"
164+
"NOTE: This assumes you have your PS2's DST set to Winter Time.<br>"
165165
"Some games require an RTC date/time set after their release date."));
166166

167167
updateOptimalFramePacing();

pcsx2/CDVD/CDVD.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,23 +922,26 @@ void cdvdReset()
922922

923923
if (EmuConfig.ManuallySetRealTimeClock)
924924
{
925-
// Convert to GMT+9 (assumes GMT+0)
926925
std::tm tm{};
927926
tm.tm_sec = EmuConfig.RtcSecond;
928927
tm.tm_min = EmuConfig.RtcMinute;
929928
tm.tm_hour = EmuConfig.RtcHour;
930929
tm.tm_mday = EmuConfig.RtcDay;
931930
tm.tm_mon = EmuConfig.RtcMonth - 1;
932931
tm.tm_year = EmuConfig.RtcYear + 100; // 2000 - 1900
933-
tm.tm_isdst = 1;
932+
tm.tm_isdst = 0;
933+
934+
ReadOSDConfigParames();
934935

935936
// Need this instead of mktime for timezone independence
936937
std::time_t t = 0;
938+
939+
// Convert to GMT+9
937940
#if defined(_WIN32)
938-
t = _mkgmtime(&tm) + 32400; //60 * 60 * 9 for GMT+9
941+
t = _mkgmtime(&tm) + 32400 - (configParams1.timezoneOffset * 60);
939942
gmtime_s(&tm, &t);
940943
#else
941-
t = timegm(&tm) + 32400;
944+
t = timegm(&tm) + 32400 - (configParams1.timezoneOffset * 60);
942945
gmtime_r(&t, &tm);
943946
#endif
944947

0 commit comments

Comments
 (0)