Re: storing TZ along timestamps

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Christopher Browne <cbbrowne(at)gmail(dot)com>, Steve Crawford <scrawford(at)pinpointresearch(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: storing TZ along timestamps
Date: 2011-06-04 08:56:43
Message-ID: BANLkTimRGA59Bwsc4C4tO8RKUODsyMyitw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 2, 2011 at 8:58 PM, Jim Nasby <jim(at)nasby(dot)net> wrote:
>
> I'm torn between whether the type should store the original time or the original time converted to GMT.

This is the wrong way to think about it. We *never* store time
"converted to GMT". When we want to represent a point in time we
represent it as seconds since the epoch. This is a quantity that is
the same everywhere in the world (modulo relativistic effects...) ie.
it's a concept which is completely independent of timezones.

The question here is how to represent more complex concepts than
simply points in time. I think the two concepts under discussion are
a) a composite type representing a point in time and a timezone it
should be interpreted in for operations and display and b) the
original input provided which is a text string with the constraint
that it's a valid input which can be interpreted as a point in time.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Radosław Smogura 2011-06-04 09:16:31 Re: BLOB support
Previous Message Andrew Chernow 2011-06-04 02:36:37 Re: Error in PQsetvalue