From 287487eb1fae176c65d4a289cc6398ad5aa3b751 Mon Sep 17 00:00:00 2001 From: Sahin Habermann Date: Thu, 22 Feb 2018 00:04:03 +0100 Subject: [PATCH] Draw current time --- common/menu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/menu.c b/common/menu.c index d885d29..cfe212b 100644 --- a/common/menu.c +++ b/common/menu.c @@ -1,3 +1,4 @@ +#include #include "common.h" #include "switchicon_questionmark_bin.h" @@ -191,6 +192,23 @@ void drawWave(float timer, color_t color, float height, float phase, float speed } } +void drawTime() { + + char timeString[9]; + + time_t unixTime = time(NULL); + struct tm* timeStruct = gmtime((const time_t *)&unixTime); + + int hours = timeStruct->tm_hour; + int minutes = timeStruct->tm_min; + int seconds = timeStruct->tm_sec; + + sprintf(timeString, "%02d:%02d:%02d", hours, minutes, seconds); + + DrawText(tahoma24, 1280 - (9 * 16) - 30, 30, MakeColor(255, 255, 255, 255), timeString); + +} + void menuLoop() { menuEntry_s* me; menu_s* menu = menuGetCurrent(); @@ -213,6 +231,8 @@ void menuLoop() { DrawText(tahoma12, 40 + 46, 30 + 16, MakeColor(255, 255, 255, 255), "v1.0.0"); DrawText(tahoma12, 40, 720 - 32 - 16, MakeColor(255, 255, 255, 255), menu->dirname); + drawTime(); + if (menu->nEntries==0) { DrawText(tahoma12, 64, 96 + 32, MakeColor(64, 64, 64, 255), textGetString(StrId_NoAppsFound_Msg));