<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Fri, 09 Dec 2011 23:11:14 +0000
From   : jgh@... (jgh@...)
Subject: BeebEm query

jgh wrote:
(re Y2KAdjust: "D'oh")

Can I suggest to the Maintainers Of The Source the following tweek in 
sysvia.ccp:

/*-------------------------------------------------------------------------*/
void RTCInit(void) {
[snip]
     CMOSRAM[9] = BCD((CurTime->tm_year)-(RTCY2KAdjust ? 20 : 0));
     /* New line here: */
     if (CMOSRAM[9] > 0x9F) CMOSRAM[9]=CMOSRAM[9]-0xA0; /* 0xA0+ wrap to 
0x00+ */
     RTCTimeOffset = SysTime - CMOSConvertClock();
}
/*-------------------------------------------------------------------------*/
void RTCUpdate(void) {
[snip]
     CMOSRAM[9] = BCD(CurTime->tm_year);
     /* New line here: */
     if (CMOSRAM[9] > 0x9F) CMOSRAM[9]=CMOSRAM[9]-0xA0; /* 0xA0+ wrap to 
0x00+ */
}

Currently, the code results in a host year of 2000+ being returned by 
the
emulated MOS as year A0+, for example 08-Dec-2009 is returned as 
08-Dec-xxA9,
09-Dec-2011 is returned as 09-Dec-xxB1. This fix would result in 
08-Dec-2009
being returned as 08-Dec-xx09 and 09-Dec-2011 as 09-Dec-xx11. 'xx' 
shown in
these dates as the emulated system doesn't get told the century number.

JGH
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>