From: Vincent Loupmon Date: Thu, 10 Mar 2016 15:50:32 +0000 (+0100) Subject: Fixed locale defaulting to English X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=552ba7fd94286135690f3a39f74c8e6f7743d415;p=suckless%2Fslstatus.git Fixed locale defaulting to English Changed get_datetime() a bit so it respects the user-configured locale (to use time formats with strings for days, months etc.) Same commit as last time, except it merges. --- diff --git a/slstatus.c b/slstatus.c index 23ed940..fe27be4 100644 --- a/slstatus.c +++ b/slstatus.c @@ -3,6 +3,7 @@ /* global libraries */ #include #include +#include #include #include #include @@ -191,11 +192,14 @@ get_datetime() /* get time in format */ time(&tm); + setlocale(LC_TIME, ""); if(!strftime(buf, bufsize, timeformat, localtime(&tm))) { + setlocale(LC_TIME, "C"); fprintf(stderr, "Strftime failed.\n"); return smprintf("n/a"); } + setlocale(LC_TIME, "C"); /* return time */ return smprintf("%s", buf); }