Skip site navigation (1) Skip section navigation (2)

Re: Imprecision of DAYS_PER_MONTH

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tino Wildenhain <tino(at)wildenhain(dot)de>
Cc: 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-21 16:49:33
Message-ID: 200507211649.j6LGnXY04328@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Tino Wildenhain wrote:
> 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.

Yes, I added a comment mentioning that we don't track leap seconds.
And this doesn't handle crossing uneven daylight savings time intervals.

Comments updated.

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

pgsql-hackers by date

Next:From: Josh BerkusDate: 2005-07-21 18:02:59
Subject: Re: Checkpoint cost, looks like it is WAL/CRC
Previous:From: Bruce MomjianDate: 2005-07-21 16:45:06
Subject: Re: Imprecision of DAYS_PER_MONTH

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group