summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Loupmon <vincentloupmon@gmail.com>2016-03-10 16:50:32 +0100
committerVincent Loupmon <vincentloupmon@gmail.com>2016-03-10 16:50:32 +0100
commit552ba7fd94286135690f3a39f74c8e6f7743d415 (patch)
treecdc6b279a35ba744703a3b176f30f6303923258a
parentd4d2646f6387f0245ce1e285382f85b2cb6c0300 (diff)
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.
-rw-r--r--slstatus.c4
1 files changed, 4 insertions, 0 deletions
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 <alsa/asoundlib.h>
#include <fcntl.h>
+#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -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);
}