Re: Imprecision of DAYS_PER_MONTH - Mailing list pgsql-hackers

From Bruno Wolff III
Subject Re: Imprecision of DAYS_PER_MONTH
Date
Msg-id 20050721140934.GB21293@wolff.to
Whole thread Raw
In response to Imprecision of DAYS_PER_MONTH  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Imprecision of DAYS_PER_MONTH  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Imprecision of DAYS_PER_MONTH  (Bruce Momjian <pgman@candle.pha.pa.us>)
Re: Imprecision of DAYS_PER_MONTH  (Ron Mayer <rm_pg@cheapcomplexdevices.com>)
List pgsql-hackers
On Thu, Jul 21, 2005 at 09:39:38 -0400, Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> 
> I have added this comment above the DAYS_PER_MONTH macro:
> 
>     + /*
>     +  *    DAYS_PER_MONTH is very imprecise.  The more accurate value is
>     +  *    365.25/12 = 30.4375, or '30 days 10:30:00'.  Right now we only
>     +  *    return an integral number of days, but someday perhaps we should
>     +  *    also return a 'time' value to be used as well.
>     +  */
>       #define DAYS_PER_MONTH        30              /* assumes exactly 30 days per month */
> 
> Let me add that we could actually do this in many places now because we
> are already converting to 'time' in those places.  Is this a TODO?

Shouldn't you be using 365.2425/12 (30.436875) for the number of days per
month?


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: recover corrupted pg_controldata from WAL
Next
From: Tom Lane
Date:
Subject: Re: Imprecision of DAYS_PER_MONTH