
> > On AIX mktime(3) leaves tm_isdst at -1 if it does not have timezone
> > info for that particular year and returns -1.
> > The following code then makes savings time out of the -1.
> >   tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
> 
> Hmm. That description is consistant with what I see in the Linux man
> page. So I should check for (tm->tm_isdst > 0) rather than 
> checking for non-zero?

It is obviously not possible to determine tm_isdst with mktime for a 
negative time_t. Thus with above fix PST works, but PDT is then busted :-(
localtime does convert a negative time_t correctly including dst.
Is there another way to determine tm_isdst ?

Andreas

Wed, 10 Jan 2001 18:26:55 +0100
Zeugswetter Andreas SB  <ZeugswetterA@wien.spardat.at>
AW: AW: Re: tinterval - operator problems on AIX
> > > On AIX mktime(3) leaves tm_isdst at -1 if it does not have timezone
> > > info for that particular year and returns -1.
> > > The following code then makes savings time out of the -1.
> > >   tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
> > Hmm. That description is consistant with what I see in the Linux man
> > page. So I should check for (tm->tm_isdst > 0) rather than
> > checking for non-zero?
> It is obviously not possible to determine tm_isdst with mktime for a
> negative time_t. Thus with above fix PST works, but PDT is then busted :-(

Obvious to AIX only? My conclusion is that the AIX timezone database is
damaged or missing for pre-1970 dates, but that other systems bothered
to get it at least somewhat right. Is there another issue here that I'm
missing?

> localtime does convert a negative time_t correctly including dst.
> Is there another way to determine tm_isdst ?

Yes. Replace AIX with Linux or something else, then recompile Postgres
;)

Seriously, not that I know of. The problem is that there is no API for
accessing time zone info other than the localtime()/mktime() kinds of
calls, so we are stuck using that (or stuck repackaging something like
zinc into Postgres directly, which afaik is not anything we would be
interested in doing).

                      - Thomas

Thu, 11 Jan 2001 03:15:59 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: AW: AW: Re: tinterval - operator problems on AIX