Re: Imprecision of DAYS_PER_MONTH

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Dann Corbit <DCorbit(at)connx(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Tino Wildenhain <tino(at)wildenhain(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>
Subject: Re: Imprecision of DAYS_PER_MONTH
Date: 2005-07-22 05:06:38
Message-ID: 200507220506.j6M56cL08183@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dann Corbit wrote:
> In round figures:
>
> Since there are 365.2422 days per tropical year, there are 31556926
> seconds per year (give or take leap seconds).
>
> Ref:
> http://www.grc.nasa.gov/WWW/K-12/Numbers/Math/Mathematical_Thinking/cale
> ndar_calculations.htm
>
>
> So 31557600 seems to be off by quite a bit.

We can look at improving these numbers, but that is more of a behavior
change rather than a code clarity change, and I am not sure we want to
get into that now. I will add a TODO to review this for 8.2.

---------------------------------------------------------------------------

>
> > -----Original Message-----
> > From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
> > owner(at)postgresql(dot)org] On Behalf Of Bruce Momjian
> > Sent: Thursday, July 21, 2005 1:35 PM
> > To: Greg Stark
> > Cc: Tino Wildenhain; Tom Lane; PostgreSQL-development; Marc G.
> Fournier
> > Subject: Re: [HACKERS] Imprecision of DAYS_PER_MONTH
> >
> > Greg Stark wrote:
> > >
> > > Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > >
> > > > > > BTW, if you actually wanted to improve readability, defining a
> > > > > > SECS_PER_YEAR value and replacing the various occurrences of
> > > > > > "36525 * 864" with it would help.
> > > > > >
> > > > > IIRC the number of seconds in a year is far from a constant.
> > > >
> > > > Yes, I added a comment mentioning that we don't track leap
> seconds.
> > > > And this doesn't handle crossing uneven daylight savings time
> > intervals.
> > >
> > > It doesn't even represent leap years, never mind leap seconds.
> >
> > Good, point, mention added.
> >
> > --
> > Bruce Momjian | http://candle.pha.pa.us
> > pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
> > + If your life is a hard drive, | 13 Roberts Road
> > + Christ can be your backup. | Newtown Square, Pennsylvania
> > 19073
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> > http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message yuanjia lee 2005-07-22 07:39:10 Re: recover corrupted pg_controldata from WAL
Previous Message Bruce Momjian 2005-07-22 05:00:45 Re: Timezone bugs