diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2008-05-06 22:15:31 +0000 |
---|---|---|
committer | Jordan Crouse <jordan.crouse@amd.com> | 2008-05-06 22:15:31 +0000 |
commit | 193378698e6cfbf774b2d9fff58c7a56880fe919 (patch) | |
tree | 9fa1ee401adfa3c1b16b608bc1f86652692d4502 | |
parent | de7fc55920cdb2cf5e3a7d547ad1d03e0b08aa5c (diff) |
coreinfo: Show the current time and date in the menu
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3286 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r-- | payloads/coreinfo/coreinfo.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c index c515d29bab..9cee12aad4 100644 --- a/payloads/coreinfo/coreinfo.c +++ b/payloads/coreinfo/coreinfo.c @@ -104,6 +104,22 @@ static void print_submenu(struct coreinfo_cat *cat) mvprintw(22, 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 @@ static void print_menu(void) mvprintw(23, 0, menu); #ifdef CONFIG_SHOW_DATE_TIME - mvprintw(23, 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 @@ static void loop(void) 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) |