diff options
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 ); } |