Re: AW: Re: tinterval - operator problems on AIX

From: Pete Forman <pete(dot)forman(at)westerngeco(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: lockhart(at)fourpalms(dot)org, Zeugswetter Andreas SB <ZeugswetterA(at)wien(dot)spardat(dot)at>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: AW: Re: tinterval - operator problems on AIX
Date: 2001-01-12 16:14:04
Message-ID: 14943.11596.712728.720702@kryten.bedford.waii.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane writes:
> Pete Forman <pete(dot)forman(at)westerngeco(dot)com> writes:
> > Thinking about that a bit more, I think that tm_isdst should not
> > be written into.
>
> IIRC, setting isdst to -1 was necessary to get the right behavior
> across DST boundaries on more-mainstream systems. I do not think
> it's acceptable to do worse on systems with good time libraries in
> order to improve behavior on fundamentally broken ones.

A footnote in the C89 (and C99) standard says:

Thus, a positive or zero value for tm_isdst causes the
mktime function to presume initially that Daylight Saving
Time, respectively, is or is not in effect for the
specified time. A negative value causes it to attempt to
determine whether Daylight Saving Time is in effect for
the specified time.

So tm_isdst being input as 0 or 1 is not forcing the choice of what it
will be on output. It can be important at the end of DST when local
times repeat and the only way to distinguish them is the setting of
this flag.

That is borne out by my observations.

Setting tm_isdst to -1 before calling mktime can make a difference to
the result when the input and result have different DST flags.

It is fairly arbitrary what the answer to this question is: if six
months is subtracted from a to give b, should a.local.hour =
b.local.hour or should a.utc.hour = b.utc.hour? If you want the
former then set tm_isdst = -1 before calling mktime. I'm out of time
now but I'll try and look for some guidance in the SQL standards.
--
Pete Forman -./\.- Disclaimer: This post is originated
WesternGeco -./\.- by myself and does not represent
pete(dot)forman(at)westerngeco(dot)com -./\.- opinion of Schlumberger, Baker
http://www.crosswinds.net/~petef -./\.- Hughes or their divisions.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael J Schout 2001-01-12 16:14:43 Re: Re: Beta2 ... ?
Previous Message Peter Eisentraut 2001-01-12 16:13:46 Re: Re: AW: Re: GiST for 7.1 !!