Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit525e1c4

Browse files
committed
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 uselessbecause HAVE_TM_ZONE overrides it anyway, and messing with configureresults isn't cool.
1 parent8b04311 commit525e1c4

25 files changed

+69
-141
lines changed

‎src/backend/utils/adt/date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.50 2000/09/12 05:41:37 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.51 2000/10/29 13:17:33 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -232,7 +232,7 @@ date_timestamp(PG_FUNCTION_ARGS)
232232

233233
if (IS_VALID_UTIME(tm->tm_year,tm->tm_mon,tm->tm_mday))
234234
{
235-
#ifdefUSE_POSIX_TIME
235+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
236236
tm->tm_hour=0;
237237
tm->tm_min=0;
238238
tm->tm_sec=0;
@@ -245,7 +245,7 @@ date_timestamp(PG_FUNCTION_ARGS)
245245
elog(ERROR,"Unable to convert date to tm");
246246

247247
result=utime+ ((date2j(1970,1,1)-date2j(2000,1,1))*86400.0);
248-
#else/* !USE_POSIX_TIME */
248+
#else
249249
result=dateVal*86400.0+CTimeZone;
250250
#endif
251251
}

‎src/backend/utils/adt/datetime.c

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.53 2000/09/12 05:41:37 thomas Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.54 2000/10/29 13:17:33 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -19,13 +19,8 @@
1919
#include<sys/types.h>
2020
#include<errno.h>
2121
#include<float.h>
22-
2322
#include<limits.h>
2423

25-
#ifndefUSE_POSIX_TIME
26-
#include<sys/timeb.h>
27-
#endif
28-
2924
#include"miscadmin.h"
3025
#include"utils/datetime.h"
3126

@@ -885,28 +880,26 @@ DecodeDateTime(char **field, int *ftype, int nf,
885880

886881
if (IS_VALID_UTIME(tm->tm_year,tm->tm_mon,tm->tm_mday))
887882
{
888-
#ifdefUSE_POSIX_TIME
883+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
889884
tm->tm_year-=1900;
890885
tm->tm_mon-=1;
891886
tm->tm_isdst=-1;
892887
mktime(tm);
893888
tm->tm_year+=1900;
894889
tm->tm_mon+=1;
895890

896-
#if defined(HAVE_TM_ZONE)
891+
#if defined(HAVE_TM_ZONE)
897892
*tzp=-(tm->tm_gmtoff);/* tm_gmtoff is
898893
* Sun/DEC-ism */
899-
#elif defined(HAVE_INT_TIMEZONE)
900-
#ifdef__CYGWIN__
894+
#elif defined(HAVE_INT_TIMEZONE)
895+
#ifdef__CYGWIN__
901896
*tzp= ((tm->tm_isdst>0) ? (_timezone-3600) :_timezone);
902-
#else
897+
#else
903898
*tzp= ((tm->tm_isdst>0) ? (timezone-3600) :timezone);
904-
#endif
905-
#else
906-
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
907-
#endif
899+
# endif/* __CYGWIN__ */
900+
# endif/* HAVE_INT_TIMEZONE */
908901

909-
#else/*!USE_POSIX_TIME */
902+
#else/*not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
910903
*tzp=CTimeZone;
911904
#endif
912905
}
@@ -1139,24 +1132,22 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
11391132
tmp->tm_min=tm->tm_min;
11401133
tmp->tm_sec=tm->tm_sec;
11411134

1142-
#ifdefUSE_POSIX_TIME
1135+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
11431136
tmp->tm_isdst=-1;
11441137
mktime(tmp);
11451138
tm->tm_isdst=tmp->tm_isdst;
11461139

1147-
#if defined(HAVE_TM_ZONE)
1140+
#if defined(HAVE_TM_ZONE)
11481141
*tzp=-(tmp->tm_gmtoff);/* tm_gmtoff is Sun/DEC-ism */
1149-
#elif defined(HAVE_INT_TIMEZONE)
1150-
#ifdef__CYGWIN__
1142+
#elif defined(HAVE_INT_TIMEZONE)
1143+
#ifdef__CYGWIN__
11511144
*tzp= ((tmp->tm_isdst>0) ? (_timezone-3600) :_timezone);
1152-
#else
1145+
#else
11531146
*tzp= ((tmp->tm_isdst>0) ? (timezone-3600) :timezone);
1154-
#endif
1155-
#else
1156-
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
1157-
#endif
1147+
# endif
1148+
# endif
11581149

1159-
#else/*!USE_POSIX_TIME */
1150+
#else/*not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
11601151
*tzp=CTimeZone;
11611152
#endif
11621153
}

‎src/backend/utils/adt/formatting.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.22 2000/09/25 12:58:47 momjian Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.23 2000/10/29 13:17:34 petere Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2000, PostgreSQL, Inc
@@ -2781,34 +2781,32 @@ to_timestamp(PG_FUNCTION_ARGS)
27812781
if (IS_VALID_UTIME(tm->tm_year,tm->tm_mon,tm->tm_mday))
27822782
{
27832783

2784-
#ifdefUSE_POSIX_TIME
2784+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
27852785
tm->tm_isdst=-1;
27862786
tm->tm_year-=1900;
27872787
tm->tm_mon-=1;
27882788

2789-
#ifdefDEBUG_TO_FROM_CHAR
2789+
#ifdefDEBUG_TO_FROM_CHAR
27902790
elog(DEBUG_elog_output,"TO-FROM_CHAR: Call mktime()");
27912791
NOTICE_TM;
2792-
#endif
2792+
#endif
27932793
mktime(tm);
27942794
tm->tm_year+=1900;
27952795
tm->tm_mon+=1;
27962796

2797-
#if defined(HAVE_TM_ZONE)
2797+
#if defined(HAVE_TM_ZONE)
27982798
tz=-(tm->tm_gmtoff);/* tm_gmtoff is Sun/DEC-ism */
2799-
#elif defined(HAVE_INT_TIMEZONE)
2799+
#elif defined(HAVE_INT_TIMEZONE)
28002800

2801-
#ifdef__CYGWIN__
2801+
#ifdef__CYGWIN__
28022802
tz= (tm->tm_isdst ? (_timezone-3600) :_timezone);
2803-
#else
2803+
#else
28042804
tz= (tm->tm_isdst ? (timezone-3600) :timezone);
2805-
#endif
2805+
#endif
28062806

2807-
#else
2808-
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
2809-
#endif
2807+
# endif
28102808

2811-
#else/*!USE_POSIX_TIME */
2809+
#else/*not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
28122810
tz=CTimeZone;
28132811
#endif
28142812
}

‎src/backend/utils/adt/nabstime.c

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.74 2000/09/29 13:53:31 petere Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.75 2000/10/29 13:17:34 petere Exp $
1313
*
1414
* NOTES
1515
*
@@ -24,7 +24,7 @@
2424
#include<float.h>
2525
#include<limits.h>
2626

27-
#ifndefUSE_POSIX_TIME
27+
#if !(defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE))
2828
#include<sys/timeb.h>
2929
#endif
3030

@@ -126,11 +126,11 @@ GetCurrentAbsoluteTime(void)
126126
{
127127
time_tnow;
128128

129-
#ifdefUSE_POSIX_TIME
129+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
130130
structtm*tm;
131131

132132
now=time(NULL);
133-
#else/* ! USE_POSIX_TIME */
133+
#else
134134
structtimebtb;/* the old V7-ism */
135135

136136
ftime(&tb);
@@ -139,7 +139,6 @@ GetCurrentAbsoluteTime(void)
139139

140140
if (!HasCTZSet)
141141
{
142-
#ifdefUSE_POSIX_TIME
143142
#if defined(HAVE_TM_ZONE)
144143
tm=localtime(&now);
145144

@@ -166,16 +165,13 @@ GetCurrentAbsoluteTime(void)
166165

167166
CDayLight=tm->tm_isdst;
168167
CTimeZone=
169-
#ifdef__CYGWIN__
168+
#ifdef__CYGWIN__
170169
(tm->tm_isdst ? (_timezone-3600) :_timezone);
171-
#else
170+
#else
172171
(tm->tm_isdst ? (timezone-3600) :timezone);
173-
#endif
172+
#endif
174173
strcpy(CTZName,tzname[tm->tm_isdst]);
175-
#else
176-
#error USE_POSIX_TIME defined but no time zone available
177-
#endif
178-
#else/* ! USE_POSIX_TIME */
174+
#else/* neither HAVE_TM_ZONE nor HAVE_INT_TIMEZONE */
179175
CTimeZone=tb.timezone*60;
180176
CDayLight= (tb.dstflag!=0);
181177

@@ -206,25 +202,23 @@ void
206202
abstime2tm(AbsoluteTime_time,int*tzp,structtm*tm,char*tzn)
207203
{
208204
time_ttime= (time_t)_time;
209-
#ifdefUSE_POSIX_TIME
205+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
210206
structtm*tx;
211207

212-
#else/* ! USE_POSIX_TIME */
208+
#else
213209
structtimebtb;/* the old V7-ism */
214210

215211
ftime(&tb);
216212
#endif
217213

218-
#ifdefUSE_POSIX_TIME
214+
215+
#if defined(HAVE_TM_ZONE)|| defined(HAVE_INT_TIMEZONE)
219216
if (tzp!=NULL)
220217
tx=localtime((time_t*)&time);
221218
else
222219
{
223220
tx=gmtime((time_t*)&time);
224221
};
225-
#endif
226-
227-
#ifdefUSE_POSIX_TIME
228222

229223
tm->tm_year=tx->tm_year+1900;
230224
tm->tm_mon=tx->tm_mon+1;
@@ -234,7 +228,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
234228
tm->tm_sec=tx->tm_sec;
235229
tm->tm_isdst=tx->tm_isdst;
236230

237-
#if defined(HAVE_TM_ZONE)
231+
#if defined(HAVE_TM_ZONE)
238232
tm->tm_gmtoff=tx->tm_gmtoff;
239233
tm->tm_zone=tx->tm_zone;
240234

@@ -252,13 +246,13 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
252246
if (strlen(tm->tm_zone)>MAXTZLEN)
253247
elog(NOTICE,"Invalid timezone \'%s\'",tm->tm_zone);
254248
}
255-
#elif defined(HAVE_INT_TIMEZONE)
249+
#elif defined(HAVE_INT_TIMEZONE)
256250
if (tzp!=NULL)
257-
#ifdef__CYGWIN__
251+
#ifdef__CYGWIN__
258252
*tzp= (tm->tm_isdst ? (_timezone-3600) :_timezone);
259-
#else
253+
#else
260254
*tzp= (tm->tm_isdst ? (timezone-3600) :timezone);
261-
#endif
255+
#endif
262256
if (tzn!=NULL)
263257
{
264258

@@ -270,10 +264,8 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
270264
if (strlen(tzname[tm->tm_isdst])>MAXTZLEN)
271265
elog(NOTICE,"Invalid timezone \'%s\'",tzname[tm->tm_isdst]);
272266
}
273-
#else
274-
#error POSIX time support is broken
275-
#endif
276-
#else/* ! USE_POSIX_TIME */
267+
# endif
268+
#else/* not (HAVE_TM_ZONE || HAVE_INT_TIMEZONE) */
277269
if (tzp!=NULL)
278270
*tzp=tb.timezone*60;
279271

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp