Adjust CalendarTime year to be relative to 0AD

This commit is contained in:
Billy Laws 2022-11-10 21:56:00 +00:00
parent 2ce2604421
commit 44033d7f8d

View File

@ -96,7 +96,7 @@ namespace skyline::service::timesrv::core {
FullCalendarTime out{ FullCalendarTime out{
.calendarTime{ .calendarTime{
.year = static_cast<u16>(posixCalendarTime->tm_year), .year = static_cast<u16>(posixCalendarTime->tm_year + 1900),
.month = static_cast<u8>(posixCalendarTime->tm_mon + 1), .month = static_cast<u8>(posixCalendarTime->tm_mon + 1),
.day = static_cast<u8>(posixCalendarTime->tm_mday), .day = static_cast<u8>(posixCalendarTime->tm_mday),
.hour = static_cast<u8>(posixCalendarTime->tm_hour), .hour = static_cast<u8>(posixCalendarTime->tm_hour),
@ -118,7 +118,7 @@ namespace skyline::service::timesrv::core {
ResultValue<PosixTime> TimeZoneManager::ToPosixTime(tz_timezone_t pRule, CalendarTime calendarTime) { ResultValue<PosixTime> TimeZoneManager::ToPosixTime(tz_timezone_t pRule, CalendarTime calendarTime) {
struct tm posixCalendarTime{ struct tm posixCalendarTime{
.tm_year = calendarTime.year, .tm_year = calendarTime.year - 1900,
.tm_mon = calendarTime.month - 1, .tm_mon = calendarTime.month - 1,
.tm_mday = calendarTime.day, .tm_mday = calendarTime.day,
.tm_min = calendarTime.minute, .tm_min = calendarTime.minute,