kern

diff src/rtc.c @ 40:710739e33da8

- now read_rtc doesn't try to read weekday as it's probably wrong anyway, and doesn't set yearday either - mktime now fixes yearday and weekday - moved init_timer and init_rtc just before enabling the interrupts in main
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 12 Jun 2011 15:45:21 +0300
parents 2c401f69128e
children
line diff
     1.1 --- a/src/rtc.c	Sun Jun 12 01:46:53 2011 +0300
     1.2 +++ b/src/rtc.c	Sun Jun 12 15:45:21 2011 +0300
     1.3 @@ -59,7 +59,6 @@
     1.4  	tm->tm_mday = read_reg(REG_DAY);
     1.5  	tm->tm_mon = read_reg(REG_MONTH);
     1.6  	tm->tm_year = read_reg(REG_YEAR);
     1.7 -	tm->tm_wday = read_reg(REG_WEEKDAY);
     1.8  
     1.9  	/* in 12hour mode, bit 7 means post-meridiem */
    1.10  	pm = tm->tm_hour & HOUR_PM_BIT;
    1.11 @@ -74,7 +73,6 @@
    1.12  		tm->tm_mday = BCD_TO_BIN(tm->tm_mday);
    1.13  		tm->tm_mon = BCD_TO_BIN(tm->tm_mon);
    1.14  		tm->tm_year = BCD_TO_BIN(tm->tm_year);
    1.15 -		tm->tm_wday = BCD_TO_BIN(tm->tm_wday);
    1.16  	}
    1.17  
    1.18  	/* make the year an offset from 1900 */
    1.19 @@ -95,8 +93,6 @@
    1.20  	}
    1.21  
    1.22  	tm->tm_mon -= 1;	/* we want months to start from 0 */
    1.23 -	tm->tm_wday -= 1;	/* we want weekdays to start from 0 */
    1.24 -	tm->tm_yday = day_of_year(tm->tm_year + 1900, tm->tm_mon, tm->tm_mday - 1);
    1.25  }
    1.26  
    1.27  static int read_reg(int reg)