Re: Imprecision of DAYS_PER_MONTH

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(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-21 15:01:23
Message-ID: 1121958084.11804.43.camel@sabrina.peacock.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am Donnerstag, den 21.07.2005, 10:48 -0400 schrieb Tom Lane:
> Another problem with this patch is the search-and-replace substitution
> of "SECS_PER_MINUTE" for "60", when in point of fact there are two
> different meanings of "60" in this context. For instance, this
> code has no problem:
>
> ! int Log_RotationAge = 24 * 60;
>
> but this code looks like it has a units error:
>
> ! int Log_RotationAge = HOURS_PER_DAY * SECS_PER_MINUTE;
>
> You need a "MINS_PER_HOUR" or some such if you don't want people
> having to look twice at the code.
>
> 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.

--
Tino Wildenhain <tino(at)wildenhain(dot)de>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-21 16:45:06 Re: Imprecision of DAYS_PER_MONTH
Previous Message Tom Lane 2005-07-21 14:48:06 Re: Imprecision of DAYS_PER_MONTH