summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-05-14 21:41:04 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-05-14 21:41:04 (GMT)
commit1f09368b39073bc30f3957f2f70911a722f5c781 (patch)
treec43bfd28868eb27530e825eb959a36371420aeb7 /generic
parentb8fec065a49ccae81c772930a794083e9fb8fc10 (diff)
downloadtcl-1f09368b39073bc30f3957f2f70911a722f5c781.zip
tcl-1f09368b39073bc30f3957f2f70911a722f5c781.tar.gz
tcl-1f09368b39073bc30f3957f2f70911a722f5c781.tar.bz2
2004-05-14 Kevin B. Kenny <kennykb@acm.org>
* generic/tclInt.decls: Promoted TclpLocaltime and TclpGmtime * generic/tclIntDecls.h: from Unix-specific stubs to the generic * generic/tclIntPlatDecls.h: internal Stubs table. Reran 'genstubs' * generic/tclStubInit.c: * unix/tclUnixPort.h: * generic/tclClock.c: Changed a buggy 'GMT' timezone specification to the correct 'GMT0'. [Bug #922848] * unix/tclUnixThrd.c: Moved TclpGmtime and TclpLocaltime to unix/tclUnixTime.c where they belong. * unix/tclUnixTime.c (TclpGmtime, TclpLocaltime, TclpGetTimeZone, ThreadSafeGMTime [removed], ThreadSafeLocalTime [removed], SetTZIfNecessary, CleanupMemory): Restructured to make sure that the same mutex protects all calls to localtime, gmtime, and tzset. Added a check in front of those calls to make sure that the TZ env var hasn't changed since the last call to tzset, and repeat tzset if necessary. [Bug #942078] Removed a buggy test of the Daylight Saving Time information in 'gettimeofday' in favor of applying 'localtime' to a known value. [Bug #922848] * tests/clock.test (clock-3.14): Added test to make sure that changes to $env(TZ) take effect immediately. * win/tclWinTime.c (TclpLocaltime, TclpGmtime): Added porting layer for 'localtime' and 'gmtime' calls.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclClock.c4
-rw-r--r--generic/tclInt.decls18
-rw-r--r--generic/tclIntDecls.h40
-rw-r--r--generic/tclIntPlatDecls.h22
-rw-r--r--generic/tclStubInit.c16
5 files changed, 80 insertions, 20 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 55c3bab..9683abb 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.20 2003/02/01 21:27:55 kennykb Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.20.2.1 2004/05/14 21:41:11 kennykb Exp $
*/
#include "tcl.h"
@@ -310,7 +310,7 @@ FormatClock(interp, clockVal, useGMT, format)
} else {
savedTZEnv = NULL;
}
- Tcl_SetVar2(interp, "env", "TZ", "GMT", TCL_GLOBAL_ONLY);
+ Tcl_SetVar2(interp, "env", "TZ", "GMT0", TCL_GLOBAL_ONLY);
savedTimeZone = timezone;
timezone = 0;
tzset();
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index 8a68f70..927e65c 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: tclInt.decls,v 1.59 2003/02/18 02:25:45 hobbs Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.59.2.1 2004/05/14 21:41:11 kennykb Exp $
library tcl
@@ -697,6 +697,15 @@ declare 173 generic {
CONST Tcl_UniChar *pattern, int ptnLen, int nocase)
}
+# TclpGmtime and TclpLocaltime promoted to the generic interface from unix
+
+declare 182 generic {
+ struct tm *TclpLocaltime(CONST time_t *clock)
+}
+declare 183 generic {
+ struct tm *TclpGmtime(CONST time_t *clock)
+}
+
##############################################################################
# Define the platform specific internal Tcl interface. These functions are
@@ -977,12 +986,15 @@ declare 10 unix {
Tcl_DirEntry * TclpReaddir(DIR * dir)
}
+# Slots 11 and 12 are forwarders for functions that were promoted to
+# generic Stubs
+
declare 11 unix {
- struct tm * TclpLocaltime(time_t * clock)
+ struct tm * TclpLocaltime_unix(CONST time_t * clock)
}
declare 12 unix {
- struct tm * TclpGmtime(time_t * clock)
+ struct tm * TclpGmtime_unix(CONST time_t * clock)
}
declare 13 unix {
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index e41dca6..d706a37 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -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: tclIntDecls.h,v 1.49 2003/02/18 02:25:45 hobbs Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.49.2.1 2004/05/14 21:41:11 kennykb Exp $
*/
#ifndef _TCLINTDECLS
@@ -503,6 +503,18 @@ EXTERN int TclUniCharMatch _ANSI_ARGS_((
CONST Tcl_UniChar * string, int strLen,
CONST Tcl_UniChar * pattern, int ptnLen,
int nocase));
+/* Slot 174 is reserved */
+/* Slot 175 is reserved */
+/* Slot 176 is reserved */
+/* Slot 177 is reserved */
+/* Slot 178 is reserved */
+/* Slot 179 is reserved */
+/* Slot 180 is reserved */
+/* Slot 181 is reserved */
+/* 182 */
+EXTERN struct tm * TclpLocaltime _ANSI_ARGS_((CONST time_t * clock));
+/* 183 */
+EXTERN struct tm * TclpGmtime _ANSI_ARGS_((CONST time_t * clock));
typedef struct TclIntStubs {
int magic;
@@ -706,6 +718,16 @@ typedef struct TclIntStubs {
int (*tclCheckExecutionTraces) _ANSI_ARGS_((Tcl_Interp * interp, CONST char * command, int numChars, Command * cmdPtr, int result, int traceFlags, int objc, Tcl_Obj *CONST objv[])); /* 171 */
int (*tclInThreadExit) _ANSI_ARGS_((void)); /* 172 */
int (*tclUniCharMatch) _ANSI_ARGS_((CONST Tcl_UniChar * string, int strLen, CONST Tcl_UniChar * pattern, int ptnLen, int nocase)); /* 173 */
+ void *reserved174;
+ void *reserved175;
+ void *reserved176;
+ void *reserved177;
+ void *reserved178;
+ void *reserved179;
+ void *reserved180;
+ void *reserved181;
+ struct tm * (*tclpLocaltime) _ANSI_ARGS_((CONST time_t * clock)); /* 182 */
+ struct tm * (*tclpGmtime) _ANSI_ARGS_((CONST time_t * clock)); /* 183 */
} TclIntStubs;
#ifdef __cplusplus
@@ -1316,6 +1338,22 @@ extern TclIntStubs *tclIntStubsPtr;
#define TclUniCharMatch \
(tclIntStubsPtr->tclUniCharMatch) /* 173 */
#endif
+/* Slot 174 is reserved */
+/* Slot 175 is reserved */
+/* Slot 176 is reserved */
+/* Slot 177 is reserved */
+/* Slot 178 is reserved */
+/* Slot 179 is reserved */
+/* Slot 180 is reserved */
+/* Slot 181 is reserved */
+#ifndef TclpLocaltime
+#define TclpLocaltime \
+ (tclIntStubsPtr->tclpLocaltime) /* 182 */
+#endif
+#ifndef TclpGmtime
+#define TclpGmtime \
+ (tclIntStubsPtr->tclpGmtime) /* 183 */
+#endif
#endif /* defined(USE_TCL_STUBS) && !defined(USE_TCL_STUB_PROCS) */
diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h
index 09c1226..c349486 100644
--- a/generic/tclIntPlatDecls.h
+++ b/generic/tclIntPlatDecls.h
@@ -9,7 +9,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.19 2002/12/06 23:22:59 hobbs Exp $
+ * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.19.2.1 2004/05/14 21:41:11 kennykb Exp $
*/
#ifndef _TCLINTPLATDECLS
@@ -62,9 +62,9 @@ EXTERN TclFile TclpCreateTempFile _ANSI_ARGS_((
/* 10 */
EXTERN Tcl_DirEntry * TclpReaddir _ANSI_ARGS_((DIR * dir));
/* 11 */
-EXTERN struct tm * TclpLocaltime _ANSI_ARGS_((time_t * clock));
+EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_((CONST time_t * clock));
/* 12 */
-EXTERN struct tm * TclpGmtime _ANSI_ARGS_((time_t * clock));
+EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((CONST time_t * clock));
/* 13 */
EXTERN char * TclpInetNtoa _ANSI_ARGS_((struct in_addr addr));
#endif /* UNIX */
@@ -229,8 +229,8 @@ typedef struct TclIntPlatStubs {
int (*tclUnixWaitForFile) _ANSI_ARGS_((int fd, int mask, int timeout)); /* 8 */
TclFile (*tclpCreateTempFile) _ANSI_ARGS_((CONST char * contents)); /* 9 */
Tcl_DirEntry * (*tclpReaddir) _ANSI_ARGS_((DIR * dir)); /* 10 */
- struct tm * (*tclpLocaltime) _ANSI_ARGS_((time_t * clock)); /* 11 */
- struct tm * (*tclpGmtime) _ANSI_ARGS_((time_t * clock)); /* 12 */
+ struct tm * (*tclpLocaltime_unix) _ANSI_ARGS_((CONST time_t * clock)); /* 11 */
+ struct tm * (*tclpGmtime_unix) _ANSI_ARGS_((CONST time_t * clock)); /* 12 */
char * (*tclpInetNtoa) _ANSI_ARGS_((struct in_addr addr)); /* 13 */
#endif /* UNIX */
#ifdef __WIN32__
@@ -351,13 +351,13 @@ extern TclIntPlatStubs *tclIntPlatStubsPtr;
#define TclpReaddir \
(tclIntPlatStubsPtr->tclpReaddir) /* 10 */
#endif
-#ifndef TclpLocaltime
-#define TclpLocaltime \
- (tclIntPlatStubsPtr->tclpLocaltime) /* 11 */
+#ifndef TclpLocaltime_unix
+#define TclpLocaltime_unix \
+ (tclIntPlatStubsPtr->tclpLocaltime_unix) /* 11 */
#endif
-#ifndef TclpGmtime
-#define TclpGmtime \
- (tclIntPlatStubsPtr->tclpGmtime) /* 12 */
+#ifndef TclpGmtime_unix
+#define TclpGmtime_unix \
+ (tclIntPlatStubsPtr->tclpGmtime_unix) /* 12 */
#endif
#ifndef TclpInetNtoa
#define TclpInetNtoa \
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index c1ed1df..238a559 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclStubInit.c,v 1.79.2.2 2003/05/13 08:41:26 das Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.79.2.3 2004/05/14 21:41:11 kennykb Exp $
*/
#include "tclInt.h"
@@ -268,6 +268,16 @@ TclIntStubs tclIntStubs = {
TclCheckExecutionTraces, /* 171 */
TclInThreadExit, /* 172 */
TclUniCharMatch, /* 173 */
+ NULL, /* 174 */
+ NULL, /* 175 */
+ NULL, /* 176 */
+ NULL, /* 177 */
+ NULL, /* 178 */
+ NULL, /* 179 */
+ NULL, /* 180 */
+ NULL, /* 181 */
+ TclpLocaltime, /* 182 */
+ TclpGmtime, /* 183 */
};
TclIntPlatStubs tclIntPlatStubs = {
@@ -285,8 +295,8 @@ TclIntPlatStubs tclIntPlatStubs = {
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
TclpReaddir, /* 10 */
- TclpLocaltime, /* 11 */
- TclpGmtime, /* 12 */
+ TclpLocaltime_unix, /* 11 */
+ TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
#endif /* UNIX */
#ifdef __WIN32__