diff options
author | kennykb <kennykb@noemail.net> | 2004-05-14 21:43:28 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2004-05-14 21:43:28 (GMT) |
commit | 9fa9bb63650355f3db6a6173aa2594cd811d99ad (patch) | |
tree | 1bd25818dd481cc051c619d9993b650758201a89 /unix/tclUnixThrd.c | |
parent | 32f4b726efb5cd2646d52a3d4c3118c2a67d97b3 (diff) | |
download | tcl-9fa9bb63650355f3db6a6173aa2594cd811d99ad.zip tcl-9fa9bb63650355f3db6a6173aa2594cd811d99ad.tar.gz tcl-9fa9bb63650355f3db6a6173aa2594cd811d99ad.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.
FossilOrigin-Name: 44753d7a62927a3ae318a223fb94a8f35b69bf08
Diffstat (limited to 'unix/tclUnixThrd.c')
-rw-r--r-- | unix/tclUnixThrd.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/unix/tclUnixThrd.c b/unix/tclUnixThrd.c index c087423..3de2319 100644 --- a/unix/tclUnixThrd.c +++ b/unix/tclUnixThrd.c @@ -20,8 +20,6 @@ typedef struct ThreadSpecificData { char nabuf[16]; - struct tm gtbuf; - struct tm ltbuf; struct { Tcl_DirEntry ent; char name[MAXNAMLEN+1]; @@ -863,51 +861,6 @@ TclpReaddir(DIR * dir) #endif return ent; } - -#if defined(TCL_THREADS) && (!defined(HAVE_GMTIME_R) || !defined(HAVE_LOCALTIME_R)) -TCL_DECLARE_MUTEX( tmMutex ) -#undef localtime -#undef gmtime -#endif - -struct tm * -TclpLocaltime(time_t * clock) -{ -#ifdef TCL_THREADS - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - -#ifdef HAVE_LOCALTIME_R - return localtime_r(clock, &tsdPtr->ltbuf); -#else - Tcl_MutexLock( &tmMutex ); - memcpy( (VOID *) &tsdPtr->ltbuf, (VOID *) localtime( clock ), sizeof (struct tm) ); - Tcl_MutexUnlock( &tmMutex ); - return &tsdPtr->ltbuf; -#endif -#else - return localtime(clock); -#endif -} - -struct tm * -TclpGmtime(time_t * clock) -{ -#ifdef TCL_THREADS - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - -#ifdef HAVE_GMTIME_R - return gmtime_r(clock, &tsdPtr->gtbuf); -#else - Tcl_MutexLock( &tmMutex ); - memcpy( (VOID *) &tsdPtr->gtbuf, (VOID *) gmtime( clock ), sizeof (struct tm) ); - Tcl_MutexUnlock( &tmMutex ); - return &tsdPtr->gtbuf; -#endif -#else - return gmtime(clock); -#endif -} - char * TclpInetNtoa(struct in_addr addr) { |