Index: rtc.c =================================================================== --- rtc.c (revision 280769) +++ rtc.c (working copy) @@ -97,7 +97,7 @@ static uint8_t rtc_nvram[RTC_NVRAM_SZ]; /* XXX initialize these to default values as they would be from BIOS */ -static uint8_t status_a, status_b; +static uint8_t status_a, status_b = RTCSB_24HR; static struct { uint8_t hours; @@ -229,11 +229,25 @@ *eax = rtcout(tm.tm_min); return (0); case RTC_HRS: - if (status_b & RTCSB_24HR) + if (status_b & RTCSB_24HR) { hour = tm.tm_hour; - else - hour = (tm.tm_hour % 12) + 1; - + } else { + switch (tm.tm_hour) { + case 0: /* 12 AM */ + case 12: /* 12 PM */ + hour = 12; + break; + default: + /* + * The remaining tm_hour values + * are interpreted as follows: + * [1 - 11] -> 1 - 11 AM + * [13 - 23] -> 1 - 11 PM + */ + hour = tm.tm_hour % 12; + break; + } + } *eax = rtcout(hour); /*