#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <locale.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_version.h>
}
}
-void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *format, const char *tz, const char *format_time, time_t t) {
+void print_time(yajl_gen json_gen, char *buffer, const char *title, const char *format, const char *tz, const char *locale, const char *format_time, time_t t) {
const char *walk;
char *outwalk = buffer;
struct tm tm;
set_timezone(tz);
localtime_r(&t, &tm);
+ if (locale != NULL) {
+ setlocale(LC_ALL, locale);
+ }
+
if (format_time == NULL) {
strftime(timebuf, sizeof(timebuf), format, &tm);
maybe_escape_markup(timebuf, &outwalk);
}
}
+ if (locale != NULL) {
+ setlocale(LC_ALL, "");
+ }
+
*outwalk = '\0';
OUTPUT_FULL_TEXT(buffer);
}