[coreboot] r3286 - trunk/payloads/coreinfo

svn at coreboot.org svn at coreboot.org
Wed May 7 00:15:32 CEST 2008


Author: jcrouse
Date: 2008-05-07 00:15:31 +0200 (Wed, 07 May 2008)
New Revision: 3286

Modified:
   trunk/payloads/coreinfo/coreinfo.c
Log:
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>


Modified: trunk/payloads/coreinfo/coreinfo.c
===================================================================
--- trunk/payloads/coreinfo/coreinfo.c	2008-05-06 22:03:16 UTC (rev 3285)
+++ trunk/payloads/coreinfo/coreinfo.c	2008-05-06 22:15:31 UTC (rev 3286)
@@ -104,6 +104,22 @@
 	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 @@
 	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 @@
 	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)





More information about the coreboot mailing list