Draw current time

This commit is contained in:
Sahin Habermann 2018-02-22 00:04:03 +01:00 committed by plutoo
parent 88d13d29e2
commit 287487eb1f

View File

@ -1,3 +1,4 @@
#include <time.h>
#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));