diff options
author | phk <phk@FreeBSD.org> | 1997-07-25 19:27:55 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-07-25 19:27:55 +0000 |
commit | 30db38624722a51670556ef9b2dd7ccf4fb57387 (patch) | |
tree | d2f88b3e9ffa79ffb2cc1a0699dd3ee96c47c3e5 /contrib/tcl/unix/tclUnixTime.c | |
parent | 4170733a21f58ada18a6760af477926f494b5b67 (diff) | |
download | FreeBSD-src-30db38624722a51670556ef9b2dd7ccf4fb57387.zip FreeBSD-src-30db38624722a51670556ef9b2dd7ccf4fb57387.tar.gz |
Import TCL release 8.0 beta 2.
Diffstat (limited to 'contrib/tcl/unix/tclUnixTime.c')
-rw-r--r-- | contrib/tcl/unix/tclUnixTime.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/contrib/tcl/unix/tclUnixTime.c b/contrib/tcl/unix/tclUnixTime.c index 6c9d5af..0c6a5d0 100644 --- a/contrib/tcl/unix/tclUnixTime.c +++ b/contrib/tcl/unix/tclUnixTime.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tclUnixTime.c 1.11 96/07/23 16:17:21 + * SCCS: @(#) tclUnixTime.c 1.12 97/01/08 17:38:15 */ #include "tclInt.h" @@ -88,7 +88,8 @@ TclpGetClicks() * this function. * * Results: - * Hours east of GMT. + * The return value is the local time zone, measured in + * minutes away from GMT (-ve for east, +ve for west). * * Side effects: * None. @@ -137,6 +138,24 @@ TclpGetTimeZone (currentTime) return timeZone; #endif +#if defined(USE_DELTA_FOR_TZ) +#define TCL_GOT_TIMEZONE 1 + /* + * This hack replaces using global var timezone or gettimeofday + * in situations where they are buggy such as on AIX when libbsd.a + * is linked in. + */ + + int timeZone; + time_t tt; + struct tm *stm; + tt = 849268800L; /* 1996-11-29 12:00:00 GMT */ + stm = localtime(&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); + return timeZone; /* eg +360 for CST6CDT */ +#endif + /* * Must prefer timezone variable over gettimeofday, as gettimeofday does * not return timezone information on many systems that have moved this @@ -163,7 +182,7 @@ TclpGetTimeZone (currentTime) return timeZone; #endif -#if defined(HAVE_GETTIMEOFDAY) && !defined (TCL_GOT_TIMEZONE) +#if !defined(NO_GETTOD) && !defined (TCL_GOT_TIMEZONE) # define TCL_GOT_TIMEZONE struct timeval tv; struct timezone tz; |