Re: AW: Re: tinterval - operator problems on AIX - Mailing list pgsql-hackers

From Pete Forman
Subject Re: AW: Re: tinterval - operator problems on AIX
Date
Msg-id 14942.51308.622923.866200@kryten.bedford.waii.com
Whole thread Raw
In response to Re: AW: Re: tinterval - operator problems on AIX  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
List pgsql-hackers
Thomas Lockhart writes:
 > I haven't yet actually fixed the code, but will post patches when
 > I've done so (assuming that a fix is possible).

The normalization in this example program which subtracts 34 years
seems to work OK.  I've run it on AIX, IRIX, Linux and Solaris.  Some
examples follow.

AIX:
$ TZ=PST8PDT ago34 851995921
Local Mon Dec 30 17:32:01 1996 PST PST
      1996-12-30T17:32:01, wday=1, yday=364, isdst = 0
  UTC Tue Dec 31 01:32:01 1996 PST PST
      1996-12-31T01:32:01, wday=2, yday=365, isdst = 0
Local Sun Dec 30 17:32:01 1962 PST PST
      1962-12-30T17:32:01, wday=0, yday=363, isdst = 0
  UTC Mon Dec 31 01:32:01 1962 PST PST
      1962-12-31T01:32:01, wday=1, yday=364, isdst = 0

Linux:
$ TZ=America/Los_Angeles ago34 426475921
Local Thu Jul 07 18:32:01 1983 PDT -0700
      1983-07-07T18:32:01, wday=4, yday=187, isdst = 1
  UTC Fri Jul 08 01:32:01 1983 GMT +0000
      1983-07-08T01:32:01, wday=5, yday=188, isdst = 0
Local Thu Jul 07 18:32:01 1949 PST -0800
      1949-07-07T18:32:01, wday=4, yday=187, isdst = 0
  UTC Fri Jul 08 02:32:01 1949 GMT +0000
      1949-07-08T02:32:01, wday=5, yday=188, isdst = 0

Here is the program.  The call to localtime(&t_ago) is redundant and
hence the adjustment of t_ago can be skipped.  It is in this program
as a sanity check.

As it stands, this program assumes that the input and resulting date
are in the usual UNIX range of [1901, 2038].  I presume that there is
code in place that checks the range of dates.



--
Pete Forman                 -./\.- Disclaimer: This post is originated
WesternGeco                   -./\.-  by myself and does not represent
pete.forman@westerngeco.com     -./\.-  opinion of Schlumberger, Baker
http://www.crosswinds.net/~petef  -./\.-  Hughes or their divisions.

Attachment

pgsql-hackers by date:

Previous
From: "Valter Mazzola"
Date:
Subject: Re: Pg7.1beta3: connect failed: The DB System is starting up.
Next
From: Oleg Bartunov
Date:
Subject: RE: AW: Re: GiST for 7.1 !!