Skip site navigation (1) Skip section navigation (2)

Re: tzcode update

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-patches(at)postgresql(dot)org>
Subject: Re: tzcode update
Date: 2008-02-14 15:40:23
Message-ID: 47B460E7.6070104@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-patches
Tom Lane wrote:
> "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:
>> Looking closer, I don't understand how that change was supposed to do 
>> anything.
> 
> The point of that patch is to avoid an off-by-one result for years BC.
> The direction of rounding in integer division with a negative numerator
> is undefined in C (or at least used to be --- did C99 tighten this up?).

Oh, I see. In that case we're good. The corresponding new code in tzcode 
  actually looks like this:

> ! static int
> ! leaps_thru_end_of(const int y)
> ! {
> !       return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
> !               -(leaps_thru_end_of(-(y + 1)) + 1);
> ! }


-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

pgsql-patches by date

Next:From: Gevik BabakhaniDate: 2008-02-14 15:47:09
Subject: Fix for 8.3 MSVC locale (Was [HACKERS] NLS on MSVC strikes back!)
Previous:From: Greg SmithDate: 2008-02-14 14:41:39
Subject: Re: PG quitting sporadically!!

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group