]> granicus.if.org Git - postgresql/commitdiff
Please apply the following patch to fix AIX and IRIX timestamp behavior
authorBruce Momjian <bruce@momjian.us>
Tue, 13 Feb 2001 14:32:52 +0000 (14:32 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 13 Feb 2001 14:32:52 +0000 (14:32 +0000)
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

src/backend/utils/adt/nabstime.c
src/backend/utils/adt/timestamp.c
src/include/port/aix.h
src/include/port/irix5.h
src/test/regress/resultmap

index 434b5c95a83932c846d5afffbfc423b977093787..31117389b0a991e25a92f08ec91167b3ec13ad06 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.80 2001/01/24 19:43:14 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.81 2001/02/13 14:32:52 momjian Exp $
  *
  * NOTES
  *
@@ -205,7 +205,17 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char *tzn)
 
 #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
        if (tzp != NULL)
+       {
                tx = localtime((time_t *) &time);
+# ifdef NO_MKTIME_BEFORE_1970
+               if (tx->tm_year < 70 && tx->tm_isdst == 1)
+               {
+                       time -= 3600;
+                       tx = localtime((time_t *) &time);
+                       tx->tm_isdst = 0;
+               }
+# endif
+       }
        else
        {
                tx = gmtime((time_t *) &time);
index e3facb7f1e48ca9d43dc29a4ac3899b3489c2ce6..a01a790124f996d46af47a4b9da7bbb13cc7f099 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.44 2001/01/24 19:43:14 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.45 2001/02/13 14:32:52 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -315,6 +315,14 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
 
 #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
                        tx = localtime(&utime);
+# ifdef NO_MKTIME_BEFORE_1970
+                       if (tx->tm_year < 70 && tx->tm_isdst == 1)
+                       {
+                               utime -= 3600;
+                               tx = localtime(&utime);
+                               tx->tm_isdst = 0;
+                       }
+# endif
                        tm->tm_year = tx->tm_year + 1900;
                        tm->tm_mon = tx->tm_mon + 1;
                        tm->tm_mday = tx->tm_mday;
index 782d84bb9134be6a7ac9d87799eca3b8111b54bb..5e4f70a7900bb561c6b838dda3a351a800fee5f0 100644 (file)
@@ -1,6 +1,7 @@
 #define CLASS_CONFLICT
 #define DISABLE_XOPEN_NLS
 #define HAS_TEST_AND_SET
+#define NO_MKTIME_BEFORE_1970
 typedef unsigned int slock_t;
 
 #include <sys/machine.h>               /* ENDIAN definitions for network
index 668796004966f1b0294c3cb3633ac1f6b87db9f7..ff91fc29227f6b2264964c1c456b9e342ec41c68 100644 (file)
@@ -1,2 +1,3 @@
 #define HAS_TEST_AND_SET
+#define NO_MKTIME_BEFORE_1970
 typedef unsigned long slock_t;
index c8f0a4302ca7aa4a9d34b4d472638930acbc54f4..417412d37f5231ec4bc94d46db16a4a659ecfb58 100644 (file)
@@ -1,5 +1,3 @@
-abstime/.*-aix4=abstime-1947-PDT
-abstime/.*-irix6=abstime-1947-PDT
 abstime/alpha.*-dec-osf=abstime-solaris-1947
 abstime/i.86-pc-solaris=abstime-solaris-1947
 abstime/sparc-sun-solaris=abstime-solaris-1947
@@ -31,8 +29,8 @@ geometry/sparc-sun-solaris=geometry-solaris-precision
 geometry/sparc.*-linux-gnu=geometry-solaris-precision
 geometry/alpha.*-linux-gnu=geometry-solaris-precision
 geometry/.*-beos=geometry-intel-beos
-horology/.*-aix4=horology-1947-PDT
-horology/.*-irix6=horology-1947-PDT
+horology/.*-aix4=horology-no-DST-before-1970
+horology/.*-irix6=horology-no-DST-before-1970
 horology/alpha.*-dec-osf=horology-solaris-1947
 horology/.*-cygwin=horology-no-DST-before-1970
 horology/hppa=horology-no-DST-before-1970
@@ -74,8 +72,6 @@ int4/sparc-sun-solaris=int4-too-large
 int4/.*-sysv5uw=int4-too-large
 int4/.*-beos=int4-range-error
 int8/.*-qnx=int8-exp-three-digits
-tinterval/.*-aix4=tinterval-1947-PDT
-tinterval/.*-irix6=tinterval-1947-PDT
 tinterval/alpha.*-dec-osf=tinterval-solaris-1947
 tinterval/i.86-pc-solaris=tinterval-solaris-1947
 tinterval/sparc-sun-solaris=tinterval-solaris-1947