summaryrefslogtreecommitdiffstats
path: root/compat/strftime.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-05-29 00:19:39 (GMT)
committerhobbs <hobbs>2002-05-29 00:19:39 (GMT)
commitacc98cfd629f847b6e4b3e7eee967d7fe3f9bcdf (patch)
tree29125ebe484614a6acad3335d784da4ad422b93a /compat/strftime.c
parent255468e31d6c18b6e10f63c0d914101824c2ce7f (diff)
downloadtcl-acc98cfd629f847b6e4b3e7eee967d7fe3f9bcdf.zip
tcl-acc98cfd629f847b6e4b3e7eee967d7fe3f9bcdf.tar.gz
tcl-acc98cfd629f847b6e4b3e7eee967d7fe3f9bcdf.tar.bz2
* tests/clock.test: added clock-9.1
* compat/strftime.c: * generic/tclClock.c: * generic/tclInt.decls: * generic/tclIntDecls.h: * unix/tclUnixTime.c: fix for Windows msvcrt mem leak caused by using an env(TZ) setting trick for in clock format -gmt 1. This also makes %s seem to work correctly with -gmt 1 as well as making it a lot faster by avoid the env(TZ) hack. TclpStrftime now takes useGMT as an arg. [Bug #559376]
Diffstat (limited to 'compat/strftime.c')
-rw-r--r--compat/strftime.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/compat/strftime.c b/compat/strftime.c
index 52a7fa1..027e373 100644
--- a/compat/strftime.c
+++ b/compat/strftime.c
@@ -8,7 +8,9 @@
* source. See the copyright notice below for details on redistribution
* restrictions. The "license.terms" file does not apply to this file.
*
- * RCS: @(#) $Id: strftime.c,v 1.9 2002/04/22 22:41:46 hobbs Exp $
+ * Changes 2002 Copyright (c) 2002 ActiveState Corporation.
+ *
+ * RCS: @(#) $Id: strftime.c,v 1.10 2002/05/29 00:19:39 hobbs Exp $
*/
/*
@@ -45,7 +47,7 @@
*/
#if defined(LIBC_SCCS)
-static char *rcsid = "$Id: strftime.c,v 1.9 2002/04/22 22:41:46 hobbs Exp $";
+static char *rcsid = "$Id: strftime.c,v 1.10 2002/05/29 00:19:39 hobbs Exp $";
#endif /* LIBC_SCCS */
#include <time.h>
@@ -103,6 +105,7 @@ static const _TimeLocale _DefaultTimeLocale =
static const _TimeLocale *_CurrentTimeLocale = &_DefaultTimeLocale;
+static int isGMT;
static size_t gsize;
static char *pt;
static int _add _ANSI_ARGS_((const char* str));
@@ -112,11 +115,12 @@ static size_t _fmt _ANSI_ARGS_((const char *format,
const struct tm *t));
size_t
-TclpStrftime(s, maxsize, format, t)
+TclpStrftime(s, maxsize, format, t, useGMT)
char *s;
size_t maxsize;
const char *format;
const struct tm *t;
+ int useGMT;
{
if (format[0] == '%' && format[1] == 'Q') {
/* Format as a stardate */
@@ -128,6 +132,11 @@ TclpStrftime(s, maxsize, format, t)
return(strlen(s));
}
+ isGMT = useGMT;
+ /*
+ * We may be able to skip this for useGMT, but it should be harmless.
+ * -- hobbs
+ */
tzset();
pt = s;
@@ -374,7 +383,7 @@ _fmt(format, t)
return(0);
continue;
case 'Z': {
- char *name = TclpGetTZName(t->tm_isdst);
+ char *name = (isGMT ? "GMT" : TclpGetTZName(t->tm_isdst));
if (name && !_add(name)) {
return 0;
}