From dce4a951bbe1ea465dcb26fa648f004f6d0db055 Mon Sep 17 00:00:00 2001 From: kanjitalk755 Date: Sun, 10 Feb 2019 11:10:23 +0900 Subject: [PATCH] invert sign of yearofs and dayofs --- BasiliskII/src/macos_util.cpp | 4 ++-- SheepShaver/src/macos_util.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BasiliskII/src/macos_util.cpp b/BasiliskII/src/macos_util.cpp index 39071f8b..dea66451 100644 --- a/BasiliskII/src/macos_util.cpp +++ b/BasiliskII/src/macos_util.cpp @@ -137,7 +137,7 @@ uint32 TimeToMacTime(time_t t) const int TM_EPOCH_YEAR = 1900; const int MAC_EPOCH_YEAR = 1904; // Clip year and day offsets to prevent dates earlier than 1-Jan-1904 - local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year - PrefsFindInt32("yearofs")); + local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year + PrefsFindInt32("yearofs")); int a4 = ((local->tm_year + TM_EPOCH_YEAR) >> 2) - !(local->tm_year & 3); int b4 = (MAC_EPOCH_YEAR >> 2) - !(MAC_EPOCH_YEAR & 3); int a100 = a4 / 25 - (a4 % 25 < 0); @@ -146,7 +146,7 @@ uint32 TimeToMacTime(time_t t) int b400 = b100 >> 2; int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); uint32 days = local->tm_yday + 365 * (local->tm_year - 4) + intervening_leap_days; - int32 dayofs = PrefsFindInt32("dayofs"); + int32 dayofs = -PrefsFindInt32("dayofs"); if(dayofs > 0 && dayofs > days) dayofs = days; return local->tm_sec + 60 * (local->tm_min + 60 * (local->tm_hour + 24 * (days - dayofs))); diff --git a/SheepShaver/src/macos_util.cpp b/SheepShaver/src/macos_util.cpp index a00af4ba..87eabb3d 100644 --- a/SheepShaver/src/macos_util.cpp +++ b/SheepShaver/src/macos_util.cpp @@ -336,7 +336,7 @@ uint32 TimeToMacTime(time_t t) const int TM_EPOCH_YEAR = 1900; const int MAC_EPOCH_YEAR = 1904; // Clip year and day offsets to prevent dates earlier than 1-Jan-1904 - local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year - PrefsFindInt32("yearofs")); + local->tm_year = std::max(MAC_EPOCH_YEAR - TM_EPOCH_YEAR, local->tm_year + PrefsFindInt32("yearofs")); int a4 = ((local->tm_year + TM_EPOCH_YEAR) >> 2) - !(local->tm_year & 3); int b4 = (MAC_EPOCH_YEAR >> 2) - !(MAC_EPOCH_YEAR & 3); int a100 = a4 / 25 - (a4 % 25 < 0); @@ -345,7 +345,7 @@ uint32 TimeToMacTime(time_t t) int b400 = b100 >> 2; int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400); uint32 days = local->tm_yday + 365 * (local->tm_year - 4) + intervening_leap_days; - int32 dayofs = PrefsFindInt32("dayofs"); + int32 dayofs = -PrefsFindInt32("dayofs"); if(dayofs > 0 && dayofs > days) dayofs = days; return local->tm_sec + 60 * (local->tm_min + 60 * (local->tm_hour + 24 * (days - dayofs)));