Re: Bug in Time/Date routines

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: moritz(dot)gmelin(at)gmx(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug in Time/Date routines
Date: 2000-11-02 18:18:22
Message-ID: 3A01AFEE.9E8B7115@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> > If you take any other month than October, it is working fine. So
> > 09-01-2000 + 1 month => 10-01-2000.
> regression=# select ('10-01-2000'::timestamp + ('1 month')::timespan);
> ?column?
> ------------------------
> 2000-10-31 23:00:00-05
> (1 row)
> Thomas, isn't the addition of '1 month' done symbolically in a struct tm?
> I suspect you may have forgotten to set tm_isdst = -1 before invoking
> mktime(), causing it to interpret the time of day on the target date
> as the same DST or not-DST case that applied on the initial date.
> Seems to me that both times should be taken as "local time", so you
> should force mktime() to recompute whether DST is in effect or not.

That particular operation needs mktime() called twice in some cases :(

Once for the input timestamp and once for the intermediate result. I'm
testing a fix now which gives the right result for this particular case.

- Tom

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Lennert Buytenhek 2000-11-02 20:20:00 waiting for lock?
Previous Message Tom Lane 2000-11-02 17:08:18 Re: strange array insertion