Subject: Re: single-user shell on Dreamcast
To: None <bsh@grotto.iijnet.or.jp>
From: Marcus Comstedt <marcus@idonex.se>
List: port-sh3
Date: 10/16/2000 21:17:46
>>>>> "Hiroyuki" == Hiroyuki Bessho <bsh@grotto.iijnet.or.jp> writes:
Hiroyuki> Currently I'm aware of some problems like:
Hiroyuki> + can't get date/time from RTC.
That's simple.
| static unsigned int low_read_time()
| {
| volatile unsigned int *rtc = (volatile unsigned int *)0xa0710000;
| return ((rtc[0]&0xffff)<<16)|(rtc[1]&0xffff);
| }
|
| time_t time(time_t *tloc)
| {
| unsigned int old, new;
| time_t tmp;
| if(tloc == NULL)
| tloc = &tmp;
| old = low_read_time();
| for(;;) {
| int i;
| for(i=0; i<3; i++) {
| new = low_read_time();
| if(new != old)
| break;
| }
| if(i<3)
| old = new;
| else
| break;
| }
| return *tloc = new-631152000;
| }
This gives a UNIX time_t.
// Marcus