summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2004-05-14 21:43:28 (GMT)
committerKevin B Kenny <kennykb@acm.org>2004-05-14 21:43:28 (GMT)
commitd3dd7920cd97f2c402d6fdc5c4acdb3e60c8f9cb (patch)
tree1bd25818dd481cc051c619d9993b650758201a89 /generic
parenta87aa8a1be2c89d9174660ca97ea533474e73901 (diff)
downloadtcl-d3dd7920cd97f2c402d6fdc5c4acdb3e60c8f9cb.zip
tcl-d3dd7920cd97f2c402d6fdc5c4acdb3e60c8f9cb.tar.gz
tcl-d3dd7920cd97f2c402d6fdc5c4acdb3e60c8f9cb.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.decls17
-rw-r--r--generic/tclIntDecls.h22
-rw-r--r--generic/tclIntPlatDecls.h30
-rw-r--r--generic/tclStubInit.c8
5 files changed, 57 insertions, 24 deletions
diff --git a/generic/tclClock.c b/generic/tclClock.c
index 6d23006..67570df 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.27 2004/04/15 21:06:39 dkf Exp $
+ * RCS: @(#) $Id: tclClock.c,v 1.28 2004/05/14 21:43:28 kennykb Exp $
*/
#include "tclInt.h"
@@ -313,7 +313,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 6a98616..4a7e787 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.72 2004/05/13 20:31:07 dkf Exp $
+# RCS: @(#) $Id: tclInt.decls,v 1.73 2004/05/14 21:43:29 kennykb Exp $
library tcl
@@ -736,6 +736,15 @@ declare 181 generic {
CONST char *file, int line)
}
+# 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
@@ -904,11 +913,13 @@ declare 9 unix {
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 {
char *TclpInetNtoa(struct in_addr addr)
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 09e193d..3b6fbfb 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.61 2004/03/19 18:43:15 dgp Exp $
+ * RCS: @(#) $Id: tclIntDecls.h,v 1.62 2004/05/14 21:43:29 kennykb Exp $
*/
#ifndef _TCLINTDECLS
@@ -959,6 +959,16 @@ EXTERN Tcl_Obj * TclNewListObjDirect _ANSI_ARGS_((int objc,
EXTERN Tcl_Obj * TclDbNewListObjDirect _ANSI_ARGS_((int objc,
Tcl_Obj ** objv, CONST char * file, int line));
#endif
+#ifndef TclpLocaltime_TCL_DECLARED
+#define TclpLocaltime_TCL_DECLARED
+/* 182 */
+EXTERN struct tm * TclpLocaltime _ANSI_ARGS_((CONST time_t * clock));
+#endif
+#ifndef TclpGmtime_TCL_DECLARED
+#define TclpGmtime_TCL_DECLARED
+/* 183 */
+EXTERN struct tm * TclpGmtime _ANSI_ARGS_((CONST time_t * clock));
+#endif
typedef struct TclIntStubs {
int magic;
@@ -1161,6 +1171,8 @@ typedef struct TclIntStubs {
Tcl_Obj * (*tcl_GetStartupScript) _ANSI_ARGS_((CONST char ** encodingNamePtr)); /* 179 */
Tcl_Obj * (*tclNewListObjDirect) _ANSI_ARGS_((int objc, Tcl_Obj ** objv)); /* 180 */
Tcl_Obj * (*tclDbNewListObjDirect) _ANSI_ARGS_((int objc, Tcl_Obj ** objv, CONST char * file, int line)); /* 181 */
+ struct tm * (*tclpLocaltime) _ANSI_ARGS_((CONST time_t * clock)); /* 182 */
+ struct tm * (*tclpGmtime) _ANSI_ARGS_((CONST time_t * clock)); /* 183 */
} TclIntStubs;
#ifdef __cplusplus
@@ -1797,6 +1809,14 @@ extern TclIntStubs *tclIntStubsPtr;
#define TclDbNewListObjDirect \
(tclIntStubsPtr->tclDbNewListObjDirect) /* 181 */
#endif
+#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 0d5bf30..3477646 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.22 2004/03/17 18:14:13 das Exp $
+ * RCS: @(#) $Id: tclIntPlatDecls.h,v 1.23 2004/05/14 21:43:29 kennykb Exp $
*/
#ifndef _TCLINTPLATDECLS
@@ -91,15 +91,15 @@ EXTERN TclFile TclpCreateTempFile _ANSI_ARGS_((
/* 10 */
EXTERN Tcl_DirEntry * TclpReaddir _ANSI_ARGS_((DIR * dir));
#endif
-#ifndef TclpLocaltime_TCL_DECLARED
-#define TclpLocaltime_TCL_DECLARED
+#ifndef TclpLocaltime_unix_TCL_DECLARED
+#define TclpLocaltime_unix_TCL_DECLARED
/* 11 */
-EXTERN struct tm * TclpLocaltime _ANSI_ARGS_((time_t * clock));
+EXTERN struct tm * TclpLocaltime_unix _ANSI_ARGS_((CONST time_t * clock));
#endif
-#ifndef TclpGmtime_TCL_DECLARED
-#define TclpGmtime_TCL_DECLARED
+#ifndef TclpGmtime_unix_TCL_DECLARED
+#define TclpGmtime_unix_TCL_DECLARED
/* 12 */
-EXTERN struct tm * TclpGmtime _ANSI_ARGS_((time_t * clock));
+EXTERN struct tm * TclpGmtime_unix _ANSI_ARGS_((CONST time_t * clock));
#endif
#ifndef TclpInetNtoa_TCL_DECLARED
#define TclpInetNtoa_TCL_DECLARED
@@ -300,8 +300,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 */
int (*tclUnixCopyFile) _ANSI_ARGS_((CONST char * src, CONST char * dst, CONST Tcl_StatBuf * statBufPtr, int dontCopyAtts)); /* 14 */
#endif /* UNIX */
@@ -399,13 +399,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 19266e0..8f6e4c2 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.95 2004/05/13 13:00:20 dkf Exp $
+ * RCS: @(#) $Id: tclStubInit.c,v 1.96 2004/05/14 21:43:29 kennykb Exp $
*/
#include "tclInt.h"
@@ -266,6 +266,8 @@ TclIntStubs tclIntStubs = {
Tcl_GetStartupScript, /* 179 */
TclNewListObjDirect, /* 180 */
TclDbNewListObjDirect, /* 181 */
+ TclpLocaltime, /* 182 */
+ TclpGmtime, /* 183 */
};
TclIntPlatStubs tclIntPlatStubs = {
@@ -283,8 +285,8 @@ TclIntPlatStubs tclIntPlatStubs = {
TclUnixWaitForFile, /* 8 */
TclpCreateTempFile, /* 9 */
TclpReaddir, /* 10 */
- TclpLocaltime, /* 11 */
- TclpGmtime, /* 12 */
+ TclpLocaltime_unix, /* 11 */
+ TclpGmtime_unix, /* 12 */
TclpInetNtoa, /* 13 */
TclUnixCopyFile, /* 14 */
#endif /* UNIX */