Re: [HACKERS] Macros for time magic values

2011-09-05 Thread Bruce Momjian
Alvaro Herrera wrote: Excerpts from Tom Lane's message of mar mar 15 11:42:06 -0300 2011: Kevin Grittner kevin.gritt...@wicourts.gov writes: Tom Lane t...@sss.pgh.pa.us wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: Would it help moving toward Leap Second support, and is this

Re: [HACKERS] Macros for time magic values

2011-03-15 Thread Dimitri Fontaine
Simon Riggs si...@2ndquadrant.com writes: 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

Re: [HACKERS] Macros for time magic values

2011-03-15 Thread Tom Lane
Dimitri Fontaine dimi...@2ndquadrant.fr writes: Would it help moving toward Leap Second support, and is this something we want to have? IMO we don't want to have that, as it would completely bollix datetime calculations of all kinds. You couldn't even count on stored timestamps not changing

Re: [HACKERS] Macros for time magic values

2011-03-15 Thread Kevin Grittner
Tom Lane t...@sss.pgh.pa.us wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: Would it help moving toward Leap Second support, and is this something we want to have? IMO we don't want to have that, as it would completely bollix datetime calculations of all kinds. You couldn't even

Re: [HACKERS] Macros for time magic values

2011-03-15 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes: Tom Lane t...@sss.pgh.pa.us wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: Would it help moving toward Leap Second support, and is this something we want to have? IMO we don't want to have that, as it would completely bollix

Re: [HACKERS] Macros for time magic values

2011-03-15 Thread Alvaro Herrera
Excerpts from Tom Lane's message of mar mar 15 11:42:06 -0300 2011: Kevin Grittner kevin.gritt...@wicourts.gov writes: Tom Lane t...@sss.pgh.pa.us wrote: Dimitri Fontaine dimi...@2ndquadrant.fr writes: Would it help moving toward Leap Second support, and is this something we want to have?

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Simon Riggs
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

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Robert Haas
On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggs si...@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,

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Andrew Dunstan
On 03/14/2011 09:25 AM, Robert Haas wrote: On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggssi...@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

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Bruce Momjian
Robert Haas wrote: On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggs si...@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

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Bruce Momjian
Simon Riggs 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

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Simon Riggs
On Mon, 2011-03-14 at 10:42 -0400, Bruce Momjian wrote: Simon Riggs 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,

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggs si...@2ndquadrant.com wrote: On Sat, 2011-03-12 at 22:29 +0200, Peter Eisentraut wrote: 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

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Bruce Momjian
Tom Lane wrote: Robert Haas robertmh...@gmail.com writes: On Mon, Mar 14, 2011 at 4:22 AM, Simon Riggs si...@2ndquadrant.com wrote: On Sat, 2011-03-12 at 22:29 +0200, Peter Eisentraut wrote: I think it's much clearer with the plain numbers. Yeh. It's not like the values 24, 12 or 60

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Kevin Grittner
Bruce Momjian br...@momjian.us wrote: Tom Lane wrote: some of them are pretty darn questionable because the underlying number *isn't* as well defined as all that. The macro does allow us to centralize comments on their imprecision, e.g.: /* * DAYS_PER_MONTH is very imprecise. The

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Tom Lane
Kevin Grittner kevin.gritt...@wicourts.gov writes: My first reaction that this change was about a net wash in readability for me -- in a couple places it might save me a few moments thinking about what the number was meant to represent, balanced against following the ctag back to the #define

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Robert Haas
On Mon, Mar 14, 2011 at 12:01 PM, Tom Lane t...@sss.pgh.pa.us wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: My first reaction that this change was about a net wash in readability for me -- in a couple places it might save me a few moments thinking about what the number was meant to

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Bruce Momjian
Robert Haas wrote: On Mon, Mar 14, 2011 at 12:01 PM, Tom Lane t...@sss.pgh.pa.us wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: My first reaction that this change was about a net wash in readability for me -- in a couple places it might save me a few moments thinking about what

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Bruce Momjian
Bruce Momjian wrote: Yeah, I agree. And I do think that there is also some value of having constants for SECS_PER_MINUTE and MINUTES_PER_HOUR, because otherwise it can be unclear what 60 means in a particular context. We're at the high end of what I consider reasonable in terms of

Re: [HACKERS] Macros for time magic values

2011-03-14 Thread Kevin Grittner
Bruce Momjian br...@momjian.us wrote: Let me also add that I realize I am often a royal pain in the neck. It really stands out compared to all the timid shrinking violets who post here. ;-) Seriously, I've always found that a group works best with a mix of personalities with their

Re: [HACKERS] Macros for time magic values

2011-03-12 Thread Bruce Momjian
Applied. --- 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

Re: [HACKERS] Macros for time magic values

2011-03-12 Thread Peter Eisentraut
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

[HACKERS] Macros for time magic values

2011-03-11 Thread Bruce Momjian
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. -- Bruce Momjian br...@momjian.us

Re: [HACKERS] Macros for time magic values

2011-03-11 Thread Christopher Browne
On Fri, Mar 11, 2011 at 12:50 PM, Bruce Momjian br...@momjian.us 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

Re: [HACKERS] Macros for time magic values

2011-03-11 Thread Bruce Momjian
Christopher Browne wrote: On Fri, Mar 11, 2011 at 12:50 PM, Bruce Momjian br...@momjian.us 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

Re: [HACKERS] Macros for time magic values

2011-03-11 Thread Bruce Momjian
Bruce Momjian wrote: Christopher Browne wrote: On Fri, Mar 11, 2011 at 12:50 PM, Bruce Momjian br...@momjian.us 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