Skip to content

Commit

Permalink
Fixing RTC.
Browse files Browse the repository at this point in the history
  • Loading branch information
captainys committed Dec 3, 2023
1 parent 91054b9 commit 73a1bae
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/towns/rtc/rtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,23 @@ TownsRTC::TownsRTC(class FMTownsCommon *townsPtr) : Device(townsPtr)
data|=(tm->tm_min/10);
break;
case REG_HOUR://4
{
int hour=tm->tm_hour;
if(true!=state.hour24 && 12<hour)
{
hour-=12;
}
data=hour%10;
}
break;
case REG_10HOUR://5 // Bit 2 is AM/PM
data|=(state.hour24 ? 0x08 : 0);
data|=(tm->tm_hour>=12 ? 0x04 : 0);
{
int hour;
if(state.hour24)
{
hour=tm->tm_hour;
}
else
int hour=tm->tm_hour;
if(true!=state.hour24 && 12<hour)
{
hour=tm->tm_hour%12;
hour-=12;
}
if(REG_HOUR==state.registerLatch)
{
Expand Down

0 comments on commit 73a1bae

Please sign in to comment.