Re: Macros for time magic values - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Macros for time magic values
Date
Msg-id 201103141440.p2EEekl21557@momjian.us
Whole thread Raw
In response to Re: Macros for time magic values  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Robert Haas wrote:
> On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> > On Sat, 2011-03-12 at 22:29 +0200, Peter Eisentraut wrote:
> >> On fre, 2011-03-11 at 12:50 -0500, Bruce Momjian wrote:
> >> > It has bothered me that many of our time routines use special magic
> >> > constants for time values, e.g. 24, 12, 60, etc.
> >> >
> >> > The attached patch changes these magic constants to macros to clarify
> >> > the code. ?I would like to apply this for 9.1 as a cleanup.
> >>
> >> I think it's much clearer with the plain numbers.
> >
> > Yeh. It's not like the values 24, 12 or 60 were going to change.
> 
> I had the same thought.  OTOH, even in 9.0 we have constants for
> BITS_PER_BYTE, DAYS_PER_YEAR (365.25), MONTHS_PER_YEAR, DAYS_PER_MONTH
> (30, as it turns out), HOURS_PER_DAY, SECS_PER_YEAR (that's a
> constant?), SECS_PER_DAY, SECS_PER_HOUR, MINS_PER_HOUR, USECS_PER_DAY,
> USECS_PER_HOUR, USECS_PER_MINUTE, and USECS_PER_SEC.  And there's no
> real reason to use those symbols in only some of the contexts where
> they are relevant.
> 
> So my only real gripe with this patch is that Bruce appears to have
> added duplicate definitions of SECS_PER_MINUTE and MINS_PER_HOUR to
> timestamp.h.

Good catch, duplicates removed.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Better estimates of index correlation
Next
From: Robert Haas
Date:
Subject: Re: Better estimates of index correlation