USE_POSIX_TIME replaced by HAVE_TM_ZONE || HAVE_INT_TIMEZONE, which are

equivalent.

In linux.h there were some #undef HAVE_INT_TIMEZONE, which are useless
because HAVE_TM_ZONE overrides it anyway, and messing with configure
results isn't cool.
This commit is contained in:
Peter Eisentraut 2000-10-29 13:17:34 +00:00
parent 8b04311293
commit 525e1c4436
25 changed files with 69 additions and 141 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.50 2000/09/12 05:41:37 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.51 2000/10/29 13:17:33 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -232,7 +232,7 @@ date_timestamp(PG_FUNCTION_ARGS)
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
{
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tm->tm_hour = 0;
tm->tm_min = 0;
tm->tm_sec = 0;
@ -245,7 +245,7 @@ date_timestamp(PG_FUNCTION_ARGS)
elog(ERROR, "Unable to convert date to tm");
result = utime + ((date2j(1970,1,1)-date2j(2000,1,1))*86400.0);
#else /* !USE_POSIX_TIME */
#else
result = dateVal*86400.0+CTimeZone;
#endif
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.53 2000/09/12 05:41:37 thomas Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.54 2000/10/29 13:17:33 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -19,13 +19,8 @@
#include <sys/types.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#ifndef USE_POSIX_TIME
#include <sys/timeb.h>
#endif
#include "miscadmin.h"
#include "utils/datetime.h"
@ -885,7 +880,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
{
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tm->tm_year -= 1900;
tm->tm_mon -= 1;
tm->tm_isdst = -1;
@ -893,20 +888,18 @@ DecodeDateTime(char **field, int *ftype, int nf,
tm->tm_year += 1900;
tm->tm_mon += 1;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is
* Sun/DEC-ism */
#elif defined(HAVE_INT_TIMEZONE)
#ifdef __CYGWIN__
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
*tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
#else
# else
*tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
#endif
#else
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
#endif
# endif /* __CYGWIN__ */
# endif /* HAVE_INT_TIMEZONE */
#else /* !USE_POSIX_TIME */
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
*tzp = CTimeZone;
#endif
}
@ -1139,24 +1132,22 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
tmp->tm_min = tm->tm_min;
tmp->tm_sec = tm->tm_sec;
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tmp->tm_isdst = -1;
mktime(tmp);
tm->tm_isdst = tmp->tm_isdst;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
*tzp = -(tmp->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
#elif defined(HAVE_INT_TIMEZONE)
#ifdef __CYGWIN__
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
*tzp = ((tmp->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
#else
# else
*tzp = ((tmp->tm_isdst > 0) ? (timezone - 3600) : timezone);
#endif
#else
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
#endif
# endif
# endif
#else /* !USE_POSIX_TIME */
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
*tzp = CTimeZone;
#endif
}

View File

@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.22 2000/09/25 12:58:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.23 2000/10/29 13:17:34 petere Exp $
*
*
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
@ -2781,34 +2781,32 @@ to_timestamp(PG_FUNCTION_ARGS)
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
{
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tm->tm_isdst = -1;
tm->tm_year -= 1900;
tm->tm_mon -= 1;
#ifdef DEBUG_TO_FROM_CHAR
# ifdef DEBUG_TO_FROM_CHAR
elog(DEBUG_elog_output, "TO-FROM_CHAR: Call mktime()");
NOTICE_TM;
#endif
# endif
mktime(tm);
tm->tm_year += 1900;
tm->tm_mon += 1;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
tz = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
#elif defined(HAVE_INT_TIMEZONE)
# elif defined(HAVE_INT_TIMEZONE)
#ifdef __CYGWIN__
# ifdef __CYGWIN__
tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
#else
# else
tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
#endif
# endif
#else
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
#endif
# endif
#else /* !USE_POSIX_TIME */
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
tz = CTimeZone;
#endif
}

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.74 2000/09/29 13:53:31 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.75 2000/10/29 13:17:34 petere Exp $
*
* NOTES
*
@ -24,7 +24,7 @@
#include <float.h>
#include <limits.h>
#ifndef USE_POSIX_TIME
#if !(defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE))
#include <sys/timeb.h>
#endif
@ -126,11 +126,11 @@ GetCurrentAbsoluteTime(void)
{
time_t now;
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
struct tm *tm;
now = time(NULL);
#else /* ! USE_POSIX_TIME */
#else
struct timeb tb; /* the old V7-ism */
ftime(&tb);
@ -139,7 +139,6 @@ GetCurrentAbsoluteTime(void)
if (!HasCTZSet)
{
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE)
tm = localtime(&now);
@ -166,16 +165,13 @@ GetCurrentAbsoluteTime(void)
CDayLight = tm->tm_isdst;
CTimeZone =
#ifdef __CYGWIN__
# ifdef __CYGWIN__
(tm->tm_isdst ? (_timezone - 3600) : _timezone);
#else
# else
(tm->tm_isdst ? (timezone - 3600) : timezone);
#endif
# endif
strcpy(CTZName, tzname[tm->tm_isdst]);
#else
#error USE_POSIX_TIME defined but no time zone available
#endif
#else /* ! USE_POSIX_TIME */
#else /* neither HAVE_TM_ZONE nor HAVE_INT_TIMEZONE */
CTimeZone = tb.timezone * 60;
CDayLight = (tb.dstflag != 0);
@ -206,25 +202,23 @@ void
abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
{
time_t time = (time_t) _time;
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
struct tm *tx;
#else /* ! USE_POSIX_TIME */
#else
struct timeb tb; /* the old V7-ism */
ftime(&tb);
#endif
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
if (tzp != NULL)
tx = localtime((time_t *) &time);
else
{
tx = gmtime((time_t *) &time);
};
#endif
#ifdef USE_POSIX_TIME
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;
@ -234,7 +228,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
tm->tm_sec = tx->tm_sec;
tm->tm_isdst = tx->tm_isdst;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
@ -252,13 +246,13 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
if (strlen(tm->tm_zone) > MAXTZLEN)
elog(NOTICE, "Invalid timezone \'%s\'", tm->tm_zone);
}
#elif defined(HAVE_INT_TIMEZONE)
# elif defined(HAVE_INT_TIMEZONE)
if (tzp != NULL)
#ifdef __CYGWIN__
# ifdef __CYGWIN__
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
#else
# else
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
#endif
# endif
if (tzn != NULL)
{
@ -270,10 +264,8 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
if (strlen(tzname[tm->tm_isdst]) > MAXTZLEN)
elog(NOTICE, "Invalid timezone \'%s\'", tzname[tm->tm_isdst]);
}
#else
#error POSIX time support is broken
#endif
#else /* ! USE_POSIX_TIME */
# endif
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
if (tzp != NULL)
*tzp = tb.timezone * 60;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.35 2000/08/29 04:41:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.36 2000/10/29 13:17:34 petere Exp $
*
*-------------------------------------------------------------------------
*/
@ -22,10 +22,6 @@
#include <float.h>
#include <limits.h>
#ifndef USE_POSIX_TIME
#include <sys/timeb.h>
#endif
#include "access/hash.h"
#include "access/xact.h"
#include "miscadmin.h"
@ -282,7 +278,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
sec;
time_t utime;
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
struct tm *tx;
#endif
@ -317,7 +313,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
{
utime = (dt + (date0 - date2j(1970, 1, 1)) * 86400);
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tx = localtime(&utime);
tm->tm_year = tx->tm_year + 1900;
tm->tm_mon = tx->tm_mon + 1;
@ -336,26 +332,24 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
#endif
tm->tm_isdst = tx->tm_isdst;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
if (tzn != NULL)
*tzn = (char *) tm->tm_zone;
#elif defined(HAVE_INT_TIMEZONE)
#ifdef __CYGWIN__
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
#else
# else
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
#endif
# endif
if (tzn != NULL)
*tzn = tzname[(tm->tm_isdst > 0)];
#else
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
#endif
# endif
#else /* !USE_POSIX_TIME */
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
*tzp = CTimeZone; /* V7 conventions; don't know timezone? */
if (tzn != NULL)
*tzn = CTZName;
@ -1629,7 +1623,7 @@ timestamp_trunc(PG_FUNCTION_ARGS)
if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
{
#ifdef USE_POSIX_TIME
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
tm->tm_isdst = -1;
tm->tm_year -= 1900;
tm->tm_mon -= 1;
@ -1638,21 +1632,19 @@ timestamp_trunc(PG_FUNCTION_ARGS)
tm->tm_year += 1900;
tm->tm_mon += 1;
#if defined(HAVE_TM_ZONE)
# if defined(HAVE_TM_ZONE)
tz = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
#elif defined(HAVE_INT_TIMEZONE)
# elif defined(HAVE_INT_TIMEZONE)
#ifdef __CYGWIN__
# ifdef __CYGWIN__
tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
#else
# else
tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
#endif
# endif
#else
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
#endif
# endif
#else /* !USE_POSIX_TIME */
#else /* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
tz = CTimeZone;
#endif
}

View File

@ -1,4 +1,3 @@
#define USE_POSIX_TIME
#define CLASS_CONFLICT
#define DISABLE_XOPEN_NLS
#define HAS_TEST_AND_SET

View File

@ -1,7 +1,6 @@
#include <kernel/OS.h>
#include "kernel/image.h"
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;

View File

@ -5,7 +5,6 @@
#define NEED_SPARC_TAS_ASM
#endif
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#if defined(__i386__)
#define NEED_I386_TAS_ASM
#define HAS_TEST_AND_SET

View File

@ -1,4 +1,3 @@
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef struct
{

View File

@ -1,3 +1,2 @@
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef unsigned long slock_t;

View File

@ -1,11 +1,3 @@
/* __USE_POSIX, __USE_BSD, and __USE_BSD_SIGNAL used to be defined either
here or with -D compile options, but __ macros should be set and used by C
library macros, not Postgres code. __USE_POSIX is set by features.h,
__USE_BSD is set by bsd/signal.h, and __USE_BSD_SIGNAL appears not to
be used.
*/
#define USE_POSIX_TIME
#if defined(__i386__)
typedef unsigned char slock_t;
@ -42,13 +34,3 @@ typedef unsigned int slock_t;
#define HAS_TEST_AND_SET
#endif
#if defined(__GLIBC__) && (__GLIBC__ >= 2)
#ifdef HAVE_INT_TIMEZONE
#undef HAVE_INT_TIMEZONE
#endif
#endif
#if defined(__powerpc__)
#undef HAVE_INT_TIMEZONE
#endif

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#if defined(__i386__)
#define NEED_I386_TAS_ASM
#define HAS_TEST_AND_SET

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#if defined(__i386__)
#define NEED_I386_TAS_ASM
#define HAS_TEST_AND_SET

View File

@ -1,5 +1,4 @@
#define NOFIXADE
#define USE_POSIX_TIME
#define DISABLE_XOPEN_NLS
#define HAS_TEST_AND_SET
/*#include <sys/mman.h>*/ /* for msemaphore */

View File

@ -9,7 +9,6 @@
#include <semaphore.h> /* for sem_t */
#endif
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
#define HAVE_STRING_H

View File

@ -4,8 +4,6 @@
#define DISABLE_COMPLEX_MACRO
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
#define NEED_I386_TAS_ASM

View File

@ -1,6 +1,5 @@
/* $Header: /cvsroot/pgsql/src/include/port/solaris.h,v 1.2 2000/10/28 22:53:17 petere Exp $ */
/* $Header: /cvsroot/pgsql/src/include/port/solaris.h,v 1.3 2000/10/29 13:17:34 petere Exp $ */
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;

View File

@ -1,4 +1,3 @@
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
typedef unsigned char slock_t;

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#ifndef BYTE_ORDER
#ifdef MIPSEB
#define BYTE_ORDER BIG_ENDIAN

View File

@ -1,5 +1,4 @@
#define NOFIXADE
#define USE_POSIX_TIME
#define NEED_STRDUP
#ifndef BIG_ENDIAN

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
#define NEED_I386_TAS_ASM

View File

@ -1,5 +1,3 @@
#define USE_POSIX_TIME
#define HAS_TEST_AND_SET
#define NEED_I386_TAS_ASM

View File

@ -6,7 +6,6 @@ typedef unsigned char slock_t;
#endif
#define tzname _tzname /* should be in time.h? */
#define USE_POSIX_TIME
#define HAVE_INT_TIMEZONE /* has int _timezone */
#include <cygwin/version.h>