summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-08-07 21:30:56 (GMT)
committerhobbs <hobbs>2000-08-07 21:30:56 (GMT)
commitf18451a48535f02d09ec06858a691f100fc43bc8 (patch)
tree9a7840dc89362f3b0dc564179530f46c59131352
parent6e872bc573c8a24fd8dd79477e902ecb2aaad82e (diff)
downloadtcl-f18451a48535f02d09ec06858a691f100fc43bc8.zip
tcl-f18451a48535f02d09ec06858a691f100fc43bc8.tar.gz
tcl-f18451a48535f02d09ec06858a691f100fc43bc8.tar.bz2
* generic/tclClock.c (FormatClock): correct code to handle locale
specific return values from strftime, if any. [Bug: 3345]
-rw-r--r--generic/tclClock.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 8b2bc53..e89b51d 100644
--- a/generic/tclClock.c
+++ b/generic/tclClock.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclClock.c,v 1.9 2000/03/30 04:36:11 hobbs Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.9.2.1 2000/08/07 21:30:56 hobbs Exp $
*/
#include "tcl.h"
@@ -258,7 +258,7 @@ FormatClock(interp, clockVal, useGMT, format)
char *format; /* Format string */
{
struct tm *timeDataPtr;
- Tcl_DString buffer;
+ Tcl_DString buffer, uniBuffer;
int bufSize;
char *p;
int result;
@@ -360,7 +360,16 @@ FormatClock(interp, clockVal, useGMT, format)
return TCL_ERROR;
}
- Tcl_SetStringObj(Tcl_GetObjResult(interp), buffer.string, -1);
+ /*
+ * Convert the time to external encoding, in case we asked for
+ * a localized return value. [Bug: 3345]
+ */
+ Tcl_DStringInit(&uniBuffer);
+ Tcl_ExternalToUtfDString(NULL, buffer.string, -1, &uniBuffer);
+
+ Tcl_SetStringObj(Tcl_GetObjResult(interp), uniBuffer.string, -1);
+
+ Tcl_DStringFree(&uniBuffer);
Tcl_DStringFree(&buffer);
return TCL_OK;
}