mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user