mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
invert sign of yearofs and dayofs
This commit is contained in:
parent
2eed2f0af8
commit
dce4a951bb
@ -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)));
|
||||
|
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user