Xinqi Bao's Git

Merge pull request #8 from Vlaix/master
authorAaron Marcher <[email protected]>
Thu, 10 Mar 2016 16:29:20 +0000 (17:29 +0100)
committerAaron Marcher <[email protected]>
Thu, 10 Mar 2016 16:29:20 +0000 (17:29 +0100)
Fixed locale defaulting to English

slstatus.c

index 23ed940..fe27be4 100644 (file)
@@ -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);
 }