[coreboot] coreinfo: Update the current time and date on the screen

Jordan Crouse jordan.crouse at amd.com
Wed May 7 00:17:52 CEST 2008


On 26/04/08 01:37 +0200, Peter Stuge wrote:
> On Fri, Apr 25, 2008 at 05:27:34PM -0600, Jordan Crouse wrote:
> > coreinfo:  Show the current time and date in the menu
> > 
> > Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
> 
> Acked-by: Peter Stuge <peter at stuge.se>

r3286.  Thanks.

> I think this will make gtod() popular, so please include a warning
> notice somewhere, that the clock is not reliable.
> 
> 
> > Index: coreinfo/coreinfo.c
> > ===================================================================
> > --- coreinfo.orig/coreinfo.c	2008-04-25 10:17:41.000000000 -0600
> > +++ coreinfo/coreinfo.c	2008-04-25 11:40:49.000000000 -0600
> > @@ -108,6 +108,22 @@
> >  	mvprintw(SCREEN_Y - 2, 0, menu);
> >  }
> >  
> > +#ifdef CONFIG_SHOW_DATE_TIME
> > +static void print_time_and_date(void)
> > +{
> > +	struct tm tm;
> > +
> > +	while(nvram_updating())
> > +		mdelay(10);
> > +
> > +	rtc_read_clock(&tm);
> > +
> > +	mvprintw(23, 57, "%02d/%02d/%04d - %02d:%02d:%02d",
> > +		tm.tm_mon, tm.tm_mday, 1900+tm.tm_year, tm.tm_hour,
> > +		tm.tm_min, tm.tm_sec);
> > +}
> > +#endif
> > +
> >  static void print_menu(void)
> >  {
> >  	int i, j;
> > @@ -125,13 +141,7 @@
> >  	mvprintw(SCREEN_Y - 1, 0, menu);
> >  
> >  #ifdef CONFIG_SHOW_DATE_TIME
> > -	mvprintw(SCREEN_Y - 1, 59, "%02d/%02d/20%02d - %02d:%02d:%02d",
> > -		 bcd2dec(nvram_read(NVRAM_RTC_MONTH)),
> > -		 bcd2dec(nvram_read(NVRAM_RTC_DAY)),
> > -		 bcd2dec(nvram_read(NVRAM_RTC_YEAR)),
> > -		 bcd2dec(nvram_read(NVRAM_RTC_HOURS)),
> > -		 bcd2dec(nvram_read(NVRAM_RTC_MINUTES)),
> > -		 bcd2dec(nvram_read(NVRAM_RTC_SECONDS)));
> > +	print_time_and_date();
> >  #endif
> >  }
> >  
> > @@ -210,7 +220,14 @@
> >  	print_submenu(&categories[curwin]);
> >  	redraw_module(&categories[curwin]);
> >  
> > +	halfdelay(10);
> > +
> >  	while (1) {
> > +#ifdef CONFIG_SHOW_DATE_TIME
> > +		print_time_and_date();
> > +		refresh();
> > +#endif
> > +
> >  		key = getch();
> >  
> >  		if (key == ERR)
> 
> -- 
> coreboot mailing list
> coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
> 

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.





More information about the coreboot mailing list