Re: pgsql: Add time/date macros for code clarity: #define

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Add time/date macros for code clarity: #define
Date: 2005-07-21 04:46:05
Message-ID: 200507210446.j6L4k5u23784@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tom Lane wrote:
> momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian) writes:
> > Log Message:
> > -----------
> > Add time/date macros for code clarity:
>
> > #define DAYS_PER_YEAR 365.25
> > #define MONTHS_PER_YEAR 12
> > #define DAYS_PER_MONTH 30
> > #define HOURS_PER_DAY 24
>
> Considering that only one of these four is actually an accurate
> constant, I have to question the usefulness of this.

Yea, the problem is that these non-absolute constants are littered all
through the code, so it is best to have them at least in one place. I
will add a comment marking the non-accurate ones more clearly.

--
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

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2005-07-21 04:48:43 pgsql: Add comment marking non-exact time conversion macros.
Previous Message Bruce Momjian 2005-07-21 04:41:44 pgsql: Remove unnecessary parentheses in assignments.