From c18958e123226be0fc32b4240556f1bb56cba06d Mon Sep 17 00:00:00 2001 From: sorgelig Date: Wed, 20 Sep 2017 06:50:43 +0800 Subject: [PATCH] Show the time in menu core. --- osd.c | 2 +- user_io.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/osd.c b/osd.c index 7e8f26b..631886b 100644 --- a/osd.c +++ b/osd.c @@ -235,7 +235,7 @@ void OsdWriteOffset(unsigned char n, char *s, unsigned char invert, unsigned cha // send all characters in string to OSD while (1) { - if (i == 0) + if (i == 0 && (n < osd_size)) { // Render sidestripe unsigned char j; unsigned char tmp[8]; diff --git a/user_io.c b/user_io.c index ced19d1..1e49e65 100644 --- a/user_io.c +++ b/user_io.c @@ -1262,6 +1262,28 @@ void user_io_poll() DISKLED_OFF; } */ + + if (is_menu_core()) + { + if (!rtc_timer || CheckTimer(rtc_timer)) + { + rtc_timer = GetTimer(1000); + + time_t t = time(NULL); + struct tm tm = *localtime(&t); + + char str[64]; + sprintf(str, " MiSTer "); + if (tm.tm_year >= 117) + { + strftime(str + strlen(str), sizeof(str) - 1 - strlen(str), "%Y.%m.%d %H:%M:%S", &tm); + } + + OsdWrite(16, "", 1, 0); + OsdWrite(17, str, 1, 0); + OsdWrite(18, "", 1, 0); + } + } } if (core_type == CORE_TYPE_ARCHIE) archie_poll();