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
This commit is contained in:
@@ -104,6 +104,22 @@ static void print_submenu(struct coreinfo_cat *cat)
|
|||||||
mvprintw(22, 0, menu);
|
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)
|
static void print_menu(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -125,13 +141,7 @@ static void print_menu(void)
|
|||||||
mvprintw(23, 0, menu);
|
mvprintw(23, 0, menu);
|
||||||
|
|
||||||
#ifdef CONFIG_SHOW_DATE_TIME
|
#ifdef CONFIG_SHOW_DATE_TIME
|
||||||
mvprintw(23, 59, "%02d/%02d/20%02d - %02d:%02d:%02d",
|
print_time_and_date();
|
||||||
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)));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,7 +220,14 @@ static void loop(void)
|
|||||||
print_submenu(&categories[curwin]);
|
print_submenu(&categories[curwin]);
|
||||||
redraw_module(&categories[curwin]);
|
redraw_module(&categories[curwin]);
|
||||||
|
|
||||||
|
halfdelay(10);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
#ifdef CONFIG_SHOW_DATE_TIME
|
||||||
|
print_time_and_date();
|
||||||
|
refresh();
|
||||||
|
#endif
|
||||||
|
|
||||||
key = getch();
|
key = getch();
|
||||||
|
|
||||||
if (key == ERR)
|
if (key == ERR)
|
||||||
|
Reference in New Issue
Block a user