Attachment "strftime.patch" to
ticket [1317477fff]
added by
nobody
2005-10-08 15:29:39.
--- strftime.c.original Thu Sep 09 03:32:20 2004
+++ strftime.c Sat Oct 08 17:17:35 2005
@@ -339,7 +339,7 @@
* we must make use of the special localized calls.
*/
case 'c':
- if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE,
+ if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE|LOCALE_USE_CP_ACP,
&syst, NULL, buf, BUF_SIZ) || !_add(buf)
|| !_add(" ")) {
return(0);
@@ -349,13 +349,13 @@
* so continue to %X case here.
*/
case 'X':
- if (!GetTimeFormat(LOCALE_USER_DEFAULT, 0,
+ if (!GetTimeFormat(LOCALE_USER_DEFAULT, LOCALE_USE_CP_ACP,
&syst, NULL, buf, BUF_SIZ) || !_add(buf)) {
return(0);
}
continue;
case 'x':
- if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE,
+ if (!GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE|LOCALE_USE_CP_ACP,
&syst, NULL, buf, BUF_SIZ) || !_add(buf)) {
return(0);
}
@@ -384,10 +384,23 @@
return(0);
continue;
case 'Z': {
+#ifdef WIN32
+ /* TclpGetTZName returns UTF8 string on Windows. */
+ Tcl_DString ds;
+ char *name = (isGMT ? "GMT" : TclpGetTZName(t->tm_isdst));
+ Tcl_DStringInit(&ds);
+ name = Tcl_UtfToExternalDString(NULL, name, -1, &ds);
+ if (name && !_add(name)) {
+ Tcl_DStringFree(&ds);
+ return 0;
+ }
+ Tcl_DStringFree(&ds);
+#else
char *name = (isGMT ? "GMT" : TclpGetTZName(t->tm_isdst));
if (name && !_add(name)) {
return 0;
}
+#endif
continue;
}
case '%':