Re: tzcode update
| От | Heikki Linnakangas |
|---|---|
| Тема | Re: tzcode update |
| Дата | |
| Msg-id | 47B460E7.6070104@enterprisedb.com обсуждение исходный текст |
| Ответ на | Re: tzcode update (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-patches |
Tom Lane wrote:
> "Heikki Linnakangas" <heikki@enterprisedb.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
В списке pgsql-patches по дате отправления: