diff options
author | kennykb <kennykb@noemail.net> | 2003-05-19 17:25:36 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2003-05-19 17:25:36 (GMT) |
commit | d0ca059008cd3eeb87045488d0a76f4c1fe9f10f (patch) | |
tree | 84a81491dd3e3306a183c94bcd78ee10c7089a4c /unix | |
parent | e6c7216fa149b7e22127d8c2c82fc5313960c6d8 (diff) | |
download | tcl-d0ca059008cd3eeb87045488d0a76f4c1fe9f10f.zip tcl-d0ca059008cd3eeb87045488d0a76f4c1fe9f10f.tar.gz tcl-d0ca059008cd3eeb87045488d0a76f4c1fe9f10f.tar.bz2 |
Corrected a bug in conversion of non-ASCII chars in the format string.
FossilOrigin-Name: 38ad3535965c32f2b7ef31c6a0c3c06a04aeed09
Diffstat (limited to 'unix')
-rw-r--r-- | unix/tclUnixTime.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 4ee9df9..4f10312 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixTime.c,v 1.17 2003/05/19 05:42:36 das Exp $ + * RCS: @(#) $Id: tclUnixTime.c,v 1.18 2003/05/19 17:25:37 kennykb Exp $ */ #include "tclInt.h" @@ -328,6 +328,7 @@ TclpStrftime(s, maxsize, format, t, useGMT) { Tcl_DString utf8Buffer; size_t status; + char* utf8Format; if (format[0] == '%' && format[1] == 'Q') { /* Format as a stardate */ sprintf(s, "Stardate %2d%03d.%01d", @@ -337,11 +338,14 @@ TclpStrftime(s, maxsize, format, t, useGMT) (((t->tm_hour * 60) + t->tm_min)/144)); return(strlen(s)); } else { + Tcl_DStringInit( &utf8Buffer ); + utf8Format = Tcl_UtfToExternalDString( NULL, format, -1, &utf8Buffer ); setlocale(LC_TIME, ""); - status = strftime(s, maxsize, format, t); + status = strftime( s, maxsize, utf8Format, t ); + Tcl_DStringFree( &utf8Buffer ); if ( status > 0 ) { Tcl_DStringInit ( &utf8Buffer ); - Tcl_ExternalToUtfDString( NULL, s, status, &utf8Buffer ); + Tcl_ExternalToUtfDString( NULL, s, (int) status, &utf8Buffer ); strcpy( s, Tcl_DStringValue( &utf8Buffer ) ); Tcl_DStringFree( &utf8Buffer ); } |