Re: [PATCH] Add TimeOffset and DateOffset typedefs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Warren Turkal <turkal(at)google(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Add TimeOffset and DateOffset typedefs
Date: 2008-03-21 01:41:06
Message-ID: 10828.1206063666@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Warren Turkal <turkal(at)google(dot)com> writes:
> I added TimeOffset and DateOffset typedefs to get rid of the instances
> using the HAVE_INT64_TIMESTAMP define being used to determine the
> types of variables or functions in timestamp.c.

Applied with minor revisions. I dropped DateOffset since it didn't seem
to be pulling its weight --- there was only one use and that was
probably better declared as TimeOffset anyway. We can always add it
later if we really do need it. Also I knocked over one or two other
places (in files beyond the ones you touched) where there was a
conditional declaration that could be eliminated.

There sure are a lot of #ifdef HAVE_INT64_TIMESTAMP's left, though,
aren't there :-(. It looked like the next thing to think about was
how to unify the scale-dependent calculations. We could make some
headway by defining a conversion constant that was either 1000000
or 1.0, but I'm worried about whether the C compiler is always smart
enough to optimize away a floating point multiplication or division
by 1.0 (there are at least some contexts where it *shouldn't* do
that, I think). Might be better to make macros that either
multiply/divide by 1000000 or do nothing.

BTW, not sure if you're aware of this, but pgindent tends to add
and subtract blank lines around #if/#else/#endif commands in weird,
inconsistent ways. If the vertical spacing seems a bit odd after
you've removed a conditional, feel free to fix it. I fixed a number
of places like that in this patch.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Warren Turkal 2008-03-21 01:44:43 Re: timestamp datatype cleanup
Previous Message Tom Lane 2008-03-21 00:22:48 Re: timestamp datatype cleanup