Fix two critical flaws in TimeZone logic

The first one was the month range being different fron Nintendo one
(0-11 instead of 1-12)

The other flaw was a bad incrementation order during days & months
computation.
This commit is contained in:
Thog 2019-10-01 00:56:58 +02:00
parent 45125f0e3a
commit 5a2bf60e00
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6
2 changed files with 5 additions and 5 deletions

View file

@ -68,7 +68,9 @@ namespace Ryujinx.HLE.HOS.Services.Time
TimeSpanType testOffset = context.RequestData.ReadStruct<TimeSpanType>();
bool isRtcResetDetected = context.RequestData.ReadBoolean();
return _timeManager.SetupStandardSteadyClock(context.Thread, clockSourceId, setupValue, internalOffset, testOffset, isRtcResetDetected);
_timeManager.SetupStandardSteadyClock(context.Thread, clockSourceId, setupValue, internalOffset, testOffset, isRtcResetDetected);
return ResultCode.Success;
}
[Command(11)]

View file

@ -1357,10 +1357,8 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
int[] ip = MonthsLengths[IsLeap((int)year)];
while (dayOfYear >= ip[calendarTime.Month])
for (calendarTime.Month = 0; dayOfYear >= ip[calendarTime.Month]; ++calendarTime.Month)
{
calendarTime.Month += 1;
dayOfYear -= ip[calendarTime.Month];
}
@ -1709,7 +1707,7 @@ namespace Ryujinx.HLE.HOS.Services.Time.TimeZone
Time = new CalendarTime()
{
Year = (short)calendarTime.Year,
Month = calendarTime.Month,
Month = (sbyte)(calendarTime.Month + 1),
Day = calendarTime.Day,
Hour = calendarTime.Hour,
Minute = calendarTime.Minute,