all repos — mgba @ 4f24b82036e7219fe80fabe7161811902e4c5e0e

mGBA Game Boy Advance Emulator

GUI: Use localtime_r instead of localtime
Jeffrey Pfau jeffrey@endrift.com
Mon, 21 Sep 2015 00:01:40 -0700
commit

4f24b82036e7219fe80fabe7161811902e4c5e0e

parent

1325da2958200c0a91efdfa8fff22e20f0418bda

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M src/util/gui/menu.csrc/util/gui/menu.c

@@ -223,7 +223,8 @@

void GUIDrawClock(struct GUIParams* params) { char buffer[32]; time_t t = time(0); - struct tm* tm = localtime(&t); - strftime(buffer, sizeof(buffer), "%H:%M:%S", tm); + struct tm 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); }