- outwalk += strftime(outwalk, 4095, format, &tm);
+
+ if (locale != NULL) {
+ setlocale(LC_ALL, locale);
+ }
+
+ if (format_time == NULL) {
+ strftime(timebuf, sizeof(timebuf), format, &tm);
+ maybe_escape_markup(timebuf, &outwalk);
+ } else {
+ for (walk = format; *walk != '\0'; walk++) {
+ if (*walk != '%') {
+ *(outwalk++) = *walk;
+ continue;
+ }
+
+ if (BEGINS_WITH(walk + 1, "time")) {
+ strftime(timebuf, sizeof(timebuf), format_time, &tm);
+ maybe_escape_markup(timebuf, &outwalk);
+ walk += strlen("time");
+ }
+ }
+ }
+
+ if (locale != NULL) {
+ setlocale(LC_ALL, "");
+ }
+