diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tclInt.decls | 14 | ||||
-rw-r--r-- | generic/tclIntDecls.h | 8 | ||||
-rw-r--r-- | generic/tclIntPlatDecls.h | 8 | ||||
-rw-r--r-- | generic/tclStubInit.c | 4 | ||||
-rw-r--r-- | unix/tclUnixTime.c | 116 | ||||
-rw-r--r-- | win/tclWinTime.c | 116 |
7 files changed, 25 insertions, 250 deletions
@@ -1,3 +1,12 @@ +2012-04-12 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclInt.decls: [Bug 3514475]: remove TclpGetTimeZone + * generic/tclIntDecls.h: and TclpGetTZName + * generic/tclIntPlatDecls.h: + * generic/tclStubInit.c: + * unix/tclUnixTime.c: + * unix/tclWinTilemc: + 2012-04-11 Jan Nijtmans <nijtmans@users.sf.net> * win/tclWinInit.c: [Bug 3448512]: clock scan "1958-01-01" fails only diff --git a/generic/tclInt.decls b/generic/tclInt.decls index ff4afea..ddda097 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -319,9 +319,10 @@ declare 76 { declare 77 { void TclpGetTime(Tcl_Time *time) } -declare 78 { - int TclpGetTimeZone(unsigned long time) -} +# Removed in 8.6: +#declare 78 { +# int TclpGetTimeZone(unsigned long time) +#} # Replaced by Tcl_FSListVolumes in 8.4: #declare 79 { # int TclpListVolumes(Tcl_Interp *interp) @@ -1091,9 +1092,10 @@ declare 20 win { declare 22 win { TclFile TclpCreateTempFile(const char *contents) } -declare 23 win { - char *TclpGetTZName(int isdst) -} +# Removed in 8.6: +#declare 23 win { +# char *TclpGetTZName(int isdst) +#} declare 24 win { char *TclWinNoBackslash(char *path) } diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h index f74cc26..d01d10a 100644 --- a/generic/tclIntDecls.h +++ b/generic/tclIntDecls.h @@ -214,8 +214,7 @@ EXTERN unsigned long TclpGetClicks(void); EXTERN unsigned long TclpGetSeconds(void); /* 77 */ EXTERN void TclpGetTime(Tcl_Time *time); -/* 78 */ -EXTERN int TclpGetTimeZone(unsigned long time); +/* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ /* 81 */ @@ -685,7 +684,7 @@ typedef struct TclIntStubs { unsigned long (*tclpGetClicks) (void); /* 75 */ unsigned long (*tclpGetSeconds) (void); /* 76 */ void (*tclpGetTime) (Tcl_Time *time); /* 77 */ - int (*tclpGetTimeZone) (unsigned long time); /* 78 */ + void (*reserved78)(void); void (*reserved79)(void); void (*reserved80)(void); char * (*tclpRealloc) (char *ptr, unsigned int size); /* 81 */ @@ -996,8 +995,7 @@ extern const TclIntStubs *tclIntStubsPtr; (tclIntStubsPtr->tclpGetSeconds) /* 76 */ #define TclpGetTime \ (tclIntStubsPtr->tclpGetTime) /* 77 */ -#define TclpGetTimeZone \ - (tclIntStubsPtr->tclpGetTimeZone) /* 78 */ +/* Slot 78 is reserved */ /* Slot 79 is reserved */ /* Slot 80 is reserved */ #define TclpRealloc \ diff --git a/generic/tclIntPlatDecls.h b/generic/tclIntPlatDecls.h index a222403..bea9037 100644 --- a/generic/tclIntPlatDecls.h +++ b/generic/tclIntPlatDecls.h @@ -169,8 +169,7 @@ EXTERN void TclWinAddProcess(HANDLE hProcess, DWORD id); /* Slot 21 is reserved */ /* 22 */ EXTERN TclFile TclpCreateTempFile(const char *contents); -/* 23 */ -EXTERN char * TclpGetTZName(int isdst); +/* Slot 23 is reserved */ /* 24 */ EXTERN char * TclWinNoBackslash(char *path); /* Slot 25 is reserved */ @@ -324,7 +323,7 @@ typedef struct TclIntPlatStubs { void (*tclWinAddProcess) (HANDLE hProcess, DWORD id); /* 20 */ void (*reserved21)(void); TclFile (*tclpCreateTempFile) (const char *contents); /* 22 */ - char * (*tclpGetTZName) (int isdst); /* 23 */ + void (*reserved23)(void); char * (*tclWinNoBackslash) (char *path); /* 24 */ void (*reserved25)(void); void (*tclWinSetInterfaces) (int wide); /* 26 */ @@ -484,8 +483,7 @@ extern const TclIntPlatStubs *tclIntPlatStubsPtr; /* Slot 21 is reserved */ #define TclpCreateTempFile \ (tclIntPlatStubsPtr->tclpCreateTempFile) /* 22 */ -#define TclpGetTZName \ - (tclIntPlatStubsPtr->tclpGetTZName) /* 23 */ +/* Slot 23 is reserved */ #define TclWinNoBackslash \ (tclIntPlatStubsPtr->tclWinNoBackslash) /* 24 */ /* Slot 25 is reserved */ diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index 0fe2ccc..4d4f509 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -277,7 +277,7 @@ static const TclIntStubs tclIntStubs = { TclpGetClicks, /* 75 */ TclpGetSeconds, /* 76 */ TclpGetTime, /* 77 */ - TclpGetTimeZone, /* 78 */ + 0, /* 78 */ 0, /* 79 */ 0, /* 80 */ TclpRealloc, /* 81 */ @@ -513,7 +513,7 @@ static const TclIntPlatStubs tclIntPlatStubs = { TclWinAddProcess, /* 20 */ 0, /* 21 */ TclpCreateTempFile, /* 22 */ - TclpGetTZName, /* 23 */ + 0, /* 23 */ TclWinNoBackslash, /* 24 */ 0, /* 25 */ TclWinSetInterfaces, /* 26 */ diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 02a90a5..c7921fe 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -224,122 +224,6 @@ TclpWideClicksToNanoseconds( /* *---------------------------------------------------------------------- * - * TclpGetTimeZone -- - * - * Determines the current timezone. The method varies wildly between - * different platform implementations, so its hidden in this function. - * - * Results: - * The return value is the local time zone, measured in minutes away from - * GMT (-ve for east, +ve for west). - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TclpGetTimeZone( - unsigned long currentTime) -{ - int timeZone; - - /* - * We prefer first to use the time zone in "struct tm" if the structure - * contains such a member. Following that, we try to locate the external - * 'timezone' variable and use its value. If both of those methods fail, - * we attempt to convert a known time to local time and use the difference - * from UTC as the local time zone. In all cases, we need to undo any - * Daylight Saving Time adjustment. - */ - -#if defined(HAVE_TM_TZADJ) -#define TCL_GOT_TIMEZONE - /* - * Struct tm contains tm_tzadj - that value may be used. - */ - - time_t curTime = (time_t) currentTime; - struct tm *timeDataPtr = TclpLocaltime(&curTime); - - timeZone = timeDataPtr->tm_tzadj / 60; - if (timeDataPtr->tm_isdst) { - timeZone += 60; - } -#endif - -#if defined(HAVE_TM_GMTOFF) && !defined (TCL_GOT_TIMEZONE) -#define TCL_GOT_TIMEZONE - /* - * Struct tm contains tm_gmtoff - that value may be used. - */ - - time_t curTime = (time_t) currentTime; - struct tm *timeDataPtr = TclpLocaltime(&curTime); - - timeZone = -(timeDataPtr->tm_gmtoff / 60); - if (timeDataPtr->tm_isdst) { - timeZone += 60; - } -#endif - -#if defined(HAVE_TIMEZONE_VAR) && !defined(TCL_GOT_TIMEZONE) && !defined(USE_DELTA_FOR_TZ) -#define TCL_GOT_TIMEZONE - /* - * The 'timezone' external var is present and may be used. - */ - - SetTZIfNecessary(); - - /* - * Note: this is not a typo in "timezone" below! See tzset documentation - * for details. - */ - - timeZone = timezone / 60; -#endif - -#if !defined(TCL_GOT_TIMEZONE) -#define TCL_GOT_TIMEZONE - /* - * Fallback - determine time zone with a known reference time. - */ - - time_t tt; - struct tm *stm; - - tt = 849268800L; /* 1996-11-29 12:00:00 GMT */ - stm = TclpLocaltime(&tt); /* eg 1996-11-29 6:00:00 CST6CDT */ - - /* - * The calculation below assumes a max of +12 or -12 hours from GMT. - */ - - timeZone = (12 - stm->tm_hour)*60 + (0 - stm->tm_min); - if (stm->tm_isdst) { - timeZone += 60; - } - - /* - * Now have offset for our known reference time, eg +360 for CST6CDT. - */ -#endif - -#ifndef TCL_GOT_TIMEZONE - /* - * Cause fatal compile error, we don't know how to get timezone. - */ - -#error autoconf did not figure out how to determine the timezone. -#endif - - return timeZone; -} - -/* - *---------------------------------------------------------------------- - * * Tcl_GetTime -- * * Gets the current system time in seconds and microseconds since the diff --git a/win/tclWinTime.c b/win/tclWinTime.c index d3e19c0..daa229d 100644 --- a/win/tclWinTime.c +++ b/win/tclWinTime.c @@ -200,35 +200,6 @@ TclpGetClicks(void) /* *---------------------------------------------------------------------- * - * TclpGetTimeZone -- - * - * Determines the current timezone. The method varies wildly between - * different Platform implementations, so its hidden in this function. - * - * Results: - * Minutes west of GMT. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TclpGetTimeZone( - unsigned long currentTime) -{ - int timeZone; - - tzset(); - timeZone = timezone / 60; - - return timeZone; -} - -/* - *---------------------------------------------------------------------- - * * Tcl_GetTime -- * * Gets the current system time in seconds and microseconds since the @@ -518,93 +489,6 @@ StopCalibration( /* *---------------------------------------------------------------------- * - * TclpGetTZName -- - * - * Gets the current timezone string. - * - * Results: - * Returns a pointer to a static string, or NULL on failure. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -char * -TclpGetTZName( - int dst) -{ - int len; - char *zone, *p; - TIME_ZONE_INFORMATION tz; - Tcl_Encoding encoding; - ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); - char *name = tsdPtr->tzName; - - /* - * tzset() under Borland doesn't seem to set up tzname[] at all. - * tzset() under MSVC has the following weird observed behavior: - * First time we call "clock format [clock seconds] -format %Z -gmt 1" - * we get "GMT", but on all subsequent calls we get the current time - * ezone string, even though env(TZ) is GMT and the variable _timezone - * is 0. - */ - - name[0] = '\0'; - - zone = getenv("TZ"); - if (zone != NULL) { - /* - * TZ is of form "NST-4:30NDT", where "NST" would be the name of the - * standard time zone for this area, "-4:30" is the offset from GMT in - * hours, and "NDT is the name of the daylight savings time zone in - * this area. The offset and DST strings are optional. - */ - - len = strlen(zone); - if (len > 3) { - len = 3; - } - if (dst != 0) { - /* - * Skip the offset string and get the DST string. - */ - - p = zone + len; - p += strspn(p, "+-:0123456789"); - if (*p != '\0') { - zone = p; - len = strlen(zone); - if (len > 3) { - len = 3; - } - } - } - Tcl_ExternalToUtf(NULL, NULL, zone, len, 0, NULL, name, - sizeof(tsdPtr->tzName), NULL, NULL, NULL); - } - if (name[0] == '\0') { - if (GetTimeZoneInformation(&tz) == TIME_ZONE_ID_UNKNOWN) { - /* - * MSDN: On NT this is returned if DST is not used in the current - * TZ - */ - - dst = 0; - } - encoding = Tcl_GetEncoding(NULL, "unicode"); - Tcl_ExternalToUtf(NULL, encoding, - (char *) ((dst) ? tz.DaylightName : tz.StandardName), -1, - 0, NULL, name, sizeof(tsdPtr->tzName), NULL, NULL, NULL); - Tcl_FreeEncoding(encoding); - } - return name; -} - -/* - *---------------------------------------------------------------------- - * * TclpGetDate -- * * This function converts between seconds and struct tm. If useGMT is |