> > > I start fix my bug with "YY vs. zero" in formatting.c, and before it
> > > a see current CVS:
...
> > Hmm, is 2001-10-10 a daylight-savings transition day in your timezone?
> No, it's daylight-savings independent. The interesting thing is that
> you not see it. I found some things:
>
> * it not happen for GMT timezone, but for others only (I test 'Japan'
> and 'CET').
>
> * the difference between to_date and to_timestamp is that to_date use
> the timestamp_date() for conversion. And in the timestamp_date() is
> used timestamp2tm() that output bad 'tm' struct.
>
> The basic difference is that timestamp2tm() with right output do
> code that call localtime() and timestamp2tm() with bad output skip
> it, because 'tzp' is not defined ("if (tzp != NULL)" in this
> timestamp2tm()).
Ah! Have you tried calling timestamptz_date() instead? That one allows
handling time zones internally. Before 7.2, timestamp_date() did handle
time zones, but now we have TIMESTAMP WITHOUT TIME ZONE and TIMESTAMP
WITH TIME ZONE so those internal routines changed out from under you.
- Thomas