From: M. R. B. <ma...@uw...> - 2000-12-01 18:33:29
|
On Fri, 1 Dec 2000, Philipp Rumpf wrote: > On Thu, Nov 30, 2000 at 06:34:51PM -0600, M. R. Brown wrote: > > > I'm currently working on host-tools and I have a patch to newlib for > > gettimeofday (simply adds 20 years to the RTC val to get the Unix epoch of > > Jan. 1, 1970). I'll post the code when I get to my workstation, tommorow. > > subtract, I hope. > Er, oops, yes I meant subtract. > so arch/sh/kernel/time.c: get_rtc_time would look like this; > > static unsigned long get_rtc_time(void) > { > unsigned long val1, val2; > > do { > val1 = (ctrl_inl(high word)<<16) + (ctrl_inl(low word)&0xffff); > val2 = (ctrl_inl(high word)<<16) + (ctrl_inl(low word)&0xffff); > } while(val1 != val2); > > /* should be date -d 'jan 1 0000 1950' '+%s'. */ > val1 -= 631152000; > > return val1; > } > > I was thinking of #ifdef'ing the Dreamcast RTC code inside various CONFIG_SH_DREAMCAST macros as it isn't standard SH4 stuff. But other than that your code looks good. M. R. |