From 017949cacb6a232ed464f200062ee84fba388f3d Mon Sep 17 00:00:00 2001 From: luigi__ Date: Thu, 12 Feb 2009 18:51:08 +0000 Subject: [PATCH] Fixed a bug with PM hours in 24-hour mode. --- desmume/src/rtc.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/desmume/src/rtc.cpp b/desmume/src/rtc.cpp index 7cc866bc9..76520d1cb 100644 --- a/desmume/src/rtc.cpp +++ b/desmume/src/rtc.cpp @@ -89,12 +89,8 @@ static void rtcRecv() rtc.data[1] = toBCD(tm_local->tm_mon); rtc.data[2] = toBCD(tm_local->tm_mday); rtc.data[3] = (tm_local->tm_wday + 6) & 7; - if (!(rtc.regStatus1 & 0x02)) - { - rtc.data[4] = (tm_local->tm_hour < 12)?0x00:0x40; - tm_local->tm_hour %= 12; - } - rtc.data[4] |= toBCD(tm_local->tm_hour); + if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12; + rtc.data[4] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour); rtc.data[5] = toBCD(tm_local->tm_min); rtc.data[6] = toBCD(tm_local->tm_sec); break; @@ -105,12 +101,8 @@ static void rtcRecv() time_t tm; time(&tm); struct tm *tm_local= localtime(&tm); - if (!(rtc.regStatus1 & 0x02)) - { - rtc.data[4] = (tm_local->tm_hour < 12)?0x00:0x40; - tm_local->tm_hour %= 12; - } - rtc.data[0] |= toBCD(tm_local->tm_hour); + if (!(rtc.regStatus1 & 0x02)) tm_local->tm_hour %= 12; + rtc.data[0] = ((tm_local->tm_hour < 12) ? 0x00 : 0x40) | toBCD(tm_local->tm_hour); rtc.data[1] = toBCD(tm_local->tm_min); rtc.data[2] = toBCD(tm_local->tm_sec); break;