Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7582bd9

Browse files
committed
Please apply the following patch to fix AIX and IRIX timestamp behavior
as previously discussed. It makes AIX and IRIX not use DST for dates before 1970. The following expected files need to be removed from the regression tests, they contain wrong results and are not needed any more. src/test/regress/expected/horology-1947-PDT.out src/test/regress/expected/tinterval-1947-PDT.out src/test/regress/expected/abstime-1947-PDT.out Zeugswetter Andreas
1 parent 3527382 commit 7582bd9

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

src/backend/utils/adt/nabstime.c

+11-1
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.80 2001/01/24 19:43:14 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.81 2001/02/13 14:32:52 momjian Exp $
1313
*
1414
* NOTES
1515
*
@@ -205,7 +205,17 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
205205

206206
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
207207
if (tzp != NULL)
208+
{
208209
tx = localtime((time_t *) &time);
210+
# ifdef NO_MKTIME_BEFORE_1970
211+
if (tx->tm_year < 70 && tx->tm_isdst == 1)
212+
{
213+
time -= 3600;
214+
tx = localtime((time_t *) &time);
215+
tx->tm_isdst = 0;
216+
}
217+
# endif
218+
}
209219
else
210220
{
211221
tx = gmtime((time_t *) &time);

src/backend/utils/adt/timestamp.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.44 2001/01/24 19:43:14 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.45 2001/02/13 14:32:52 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -315,6 +315,14 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
315315

316316
#if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
317317
tx = localtime(&utime);
318+
# ifdef NO_MKTIME_BEFORE_1970
319+
if (tx->tm_year < 70 && tx->tm_isdst == 1)
320+
{
321+
utime -= 3600;
322+
tx = localtime(&utime);
323+
tx->tm_isdst = 0;
324+
}
325+
# endif
318326
tm->tm_year = tx->tm_year + 1900;
319327
tm->tm_mon = tx->tm_mon + 1;
320328
tm->tm_mday = tx->tm_mday;

src/include/port/aix.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#define CLASS_CONFLICT
22
#define DISABLE_XOPEN_NLS
33
#define HAS_TEST_AND_SET
4+
#define NO_MKTIME_BEFORE_1970
45
typedef unsigned int slock_t;
56

67
#include <sys/machine.h> /* ENDIAN definitions for network

src/include/port/irix5.h

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#define HAS_TEST_AND_SET
2+
#define NO_MKTIME_BEFORE_1970
23
typedef unsigned long slock_t;

src/test/regress/resultmap

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
abstime/.*-aix4=abstime-1947-PDT
2-
abstime/.*-irix6=abstime-1947-PDT
31
abstime/alpha.*-dec-osf=abstime-solaris-1947
42
abstime/i.86-pc-solaris=abstime-solaris-1947
53
abstime/sparc-sun-solaris=abstime-solaris-1947
@@ -31,8 +29,8 @@ geometry/sparc-sun-solaris=geometry-solaris-precision
3129
geometry/sparc.*-linux-gnu=geometry-solaris-precision
3230
geometry/alpha.*-linux-gnu=geometry-solaris-precision
3331
geometry/.*-beos=geometry-intel-beos
34-
horology/.*-aix4=horology-1947-PDT
35-
horology/.*-irix6=horology-1947-PDT
32+
horology/.*-aix4=horology-no-DST-before-1970
33+
horology/.*-irix6=horology-no-DST-before-1970
3634
horology/alpha.*-dec-osf=horology-solaris-1947
3735
horology/.*-cygwin=horology-no-DST-before-1970
3836
horology/hppa=horology-no-DST-before-1970
@@ -74,8 +72,6 @@ int4/sparc-sun-solaris=int4-too-large
7472
int4/.*-sysv5uw=int4-too-large
7573
int4/.*-beos=int4-range-error
7674
int8/.*-qnx=int8-exp-three-digits
77-
tinterval/.*-aix4=tinterval-1947-PDT
78-
tinterval/.*-irix6=tinterval-1947-PDT
7975
tinterval/alpha.*-dec-osf=tinterval-solaris-1947
8076
tinterval/i.86-pc-solaris=tinterval-solaris-1947
8177
tinterval/sparc-sun-solaris=tinterval-solaris-1947

0 commit comments

Comments
 (0)