diff options
| author | Kevin B Kenny <kennykb@acm.org> | 2003-05-19 17:25:36 (GMT) | 
|---|---|---|
| committer | Kevin B Kenny <kennykb@acm.org> | 2003-05-19 17:25:36 (GMT) | 
| commit | c22fc5dd49b8b650ef0adf2eb1eab1a879f61f95 (patch) | |
| tree | 84a81491dd3e3306a183c94bcd78ee10c7089a4c /unix/tclUnixTime.c | |
| parent | 58381305a41e2eae3c374274a299cbc08ae16d31 (diff) | |
| download | tcl-c22fc5dd49b8b650ef0adf2eb1eab1a879f61f95.zip tcl-c22fc5dd49b8b650ef0adf2eb1eab1a879f61f95.tar.gz tcl-c22fc5dd49b8b650ef0adf2eb1eab1a879f61f95.tar.bz2 | |
Corrected a bug in conversion of non-ASCII chars in the format string.
Diffstat (limited to 'unix/tclUnixTime.c')
| -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 );  	} | 
