[coreboot-gerrit] New patch to review for coreboot: coreinfo: Only update time when it actually changes

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Sun Mar 13 09:47:06 CET 2016


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14081

-gerrit

commit 1e068d94c5b2241c81086986873d1629eb01538d
Author: Stefan Reinauer <stefan.reinauer at coreboot.org>
Date:   Sun Mar 13 00:46:09 2016 -0800

    coreinfo: Only update time when it actually changes
    
    This makes cursor movements on the serial port a lot more
    bearable.
    
    Change-Id: I898beaaeb44feccf86cb79f5d9217543e67ac4d2
    Signed-off-by: Stefan Reinauer <stefan.reinauer at coreboot.org>
---
 payloads/coreinfo/coreinfo.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/payloads/coreinfo/coreinfo.c b/payloads/coreinfo/coreinfo.c
index 8a6b3f5..f2a93dc 100644
--- a/payloads/coreinfo/coreinfo.c
+++ b/payloads/coreinfo/coreinfo.c
@@ -113,6 +113,7 @@ static void print_submenu(struct coreinfo_cat *cat)
 #if IS_ENABLED(CONFIG_SHOW_DATE_TIME)
 static void print_time_and_date(void)
 {
+	static struct tm old_tm;
 	struct tm tm;
 
 	while (nvram_updating())
@@ -120,9 +121,13 @@ static void print_time_and_date(void)
 
 	rtc_read_clock(&tm);
 
-	mvwprintw(menuwin, 0, 57, "%02d/%02d/%04d - %02d:%02d:%02d",
-		  tm.tm_mon + 1, tm.tm_mday, 1900 + tm.tm_year, tm.tm_hour,
-		  tm.tm_min, tm.tm_sec);
+	if (memcmp(&old_tm, &tm, sizeof(old_tm)))
+		mvwprintw(menuwin, 0, 57, "%02d/%02d/%04d - %02d:%02d:%02d",
+			tm.tm_mon + 1, tm.tm_mday, 1900 + tm.tm_year,
+			tm.tm_hour, tm.tm_min, tm.tm_sec);
+
+	old_tm = tm;
+	wrefresh(menuwin);
 }
 #endif
 
@@ -249,7 +254,6 @@ static void loop(void)
 	while (1) {
 #if IS_ENABLED(CONFIG_SHOW_DATE_TIME)
 		print_time_and_date();
-		wrefresh(menuwin);
 #endif
 
 		key = getch();



More information about the coreboot-gerrit mailing list