GUI: Use localtime_r instead of localtime

This commit is contained in:
Jeffrey Pfau 2015-09-21 00:01:40 -07:00
parent 1325da2958
commit 4f24b82036
1 changed files with 3 additions and 2 deletions

View File

@ -223,7 +223,8 @@ void GUIDrawBattery(struct GUIParams* params) {
void GUIDrawClock(struct GUIParams* params) { void GUIDrawClock(struct GUIParams* params) {
char buffer[32]; char buffer[32];
time_t t = time(0); time_t t = time(0);
struct tm* tm = localtime(&t); struct tm tm;
strftime(buffer, sizeof(buffer), "%H:%M:%S", tm); localtime_r(&t, &tm);
strftime(buffer, sizeof(buffer), "%H:%M:%S", &tm);
GUIFontPrint(params->font, params->width / 2, GUIFontHeight(params->font), GUI_TEXT_CENTER, 0xFFFFFFFF, buffer); GUIFontPrint(params->font, params->width / 2, GUIFontHeight(params->font), GUI_TEXT_CENTER, 0xFFFFFFFF, buffer);
} }