aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-04-10 21:16:27 -0300
committergdkchan <gab.dark.100@gmail.com>2018-04-10 21:16:27 -0300
commit29a4fb6a57093a8c441fca7eb51063b4e26a1c14 (patch)
tree1ee9acceb3cd8b8061d396a3085c947798dc229d
parentcb29b4303cb0e0cbd6541943e63392ebe7b83554 (diff)
[HLE/Service] Fix ToCalendarTimeWithMyRule
-rw-r--r--Ryujinx.Core/OsHle/Services/Time/ISystemClock.cs2
-rw-r--r--Ryujinx.Core/OsHle/Services/Time/ITimeZoneService.cs27
2 files changed, 11 insertions, 18 deletions
diff --git a/Ryujinx.Core/OsHle/Services/Time/ISystemClock.cs b/Ryujinx.Core/OsHle/Services/Time/ISystemClock.cs
index 82075ee3..9cfdcc87 100644
--- a/Ryujinx.Core/OsHle/Services/Time/ISystemClock.cs
+++ b/Ryujinx.Core/OsHle/Services/Time/ISystemClock.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.Core.OsHle.Services.Time
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
- private static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private SystemClockType ClockType;
diff --git a/Ryujinx.Core/OsHle/Services/Time/ITimeZoneService.cs b/Ryujinx.Core/OsHle/Services/Time/ITimeZoneService.cs
index c162d98c..cf7abbfa 100644
--- a/Ryujinx.Core/OsHle/Services/Time/ITimeZoneService.cs
+++ b/Ryujinx.Core/OsHle/Services/Time/ITimeZoneService.cs
@@ -10,7 +10,7 @@ namespace Ryujinx.Core.OsHle.Services.Time
public override IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
- private static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local);
+ private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public ITimeZoneService()
{
@@ -20,25 +20,13 @@ namespace Ryujinx.Core.OsHle.Services.Time
};
}
- //(nn::time::PosixTime)-> (nn::time::CalendarTime, nn::time::sf::CalendarAdditionalInfo)
public long ToCalendarTimeWithMyRule(ServiceCtx Context)
{
long PosixTime = Context.RequestData.ReadInt64();
- Epoch = Epoch.AddSeconds(PosixTime).ToLocalTime();
+ DateTime CurrentTime = Epoch.AddSeconds(PosixTime).ToLocalTime();
- /*
- struct CalendarTime {
- u16_le year;
- u8 month; // Starts at 1
- u8 day; // Starts at 1
- u8 hour;
- u8 minute;
- u8 second;
- INSERT_PADDING_BYTES(1);
- };
- */
- Context.ResponseData.Write((short)Epoch.Year);
+ Context.ResponseData.Write((ushort)Epoch.Year);
Context.ResponseData.Write((byte)Epoch.Month);
Context.ResponseData.Write((byte)Epoch.Day);
Context.ResponseData.Write((byte)Epoch.Hour);
@@ -58,10 +46,15 @@ namespace Ryujinx.Core.OsHle.Services.Time
};
*/
Context.ResponseData.Write((int)Epoch.DayOfWeek);
+
Context.ResponseData.Write(Epoch.DayOfYear);
+
+ //TODO: Find out the names used.
Context.ResponseData.Write(new byte[8]);
- Context.ResponseData.Write(Convert.ToByte(Epoch.IsDaylightSavingTime()));
- Context.ResponseData.Write(0);
+
+ Context.ResponseData.Write((byte)(Epoch.IsDaylightSavingTime() ? 1 : 0));
+
+ Context.ResponseData.Write((int)TimeZoneInfo.Local.GetUtcOffset(Epoch).TotalSeconds);
return 0;
}