Re: = t1 - t0 but t0 + i <> t1 when t1 and t2 timestamptz values and i is an interval value - Mailing list pgsql-general

From Bryn Llewellyn
Subject Re: = t1 - t0 but t0 + i <> t1 when t1 and t2 timestamptz values and i is an interval value
Date
Msg-id 42FA985C-527B-4E39-A883-89DA6763AA2F@yugabyte.com
Whole thread Raw
In response to Re: = t1 - t0 but t0 + i <> t1 when t1 and t2 timestamptz values and i is an interval value  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: = t1 - t0 but t0 + i <> t1 when t1 and t2 timestamptz values and i is an interval value
List pgsql-general
> adrian.klaver@aklaver.com wrote:
>
> The point is horology is cultural, see non-Western calendars and alternate time keeping methods. Trying to maintain a
distinctionbetween the two concepts only furthers the confusion. The inconsistencies you see are the result of
one(culture)intervening in the other(horology). 

I intend the word “horology” to be taken in this sense:

« The word "horology" means "the art of making clocks and watches". So the intended meaning of the phrase "horological
interval"is "what you'd measure with a clock". The implication is "what you'd measure with the best clock that there is
(inother words, a caesium clock) but expressed in seconds and multiples thereof (hours, and minutes, but not days).” » 

There’s nothing cultural about the size of the caesium unit. It simply emerges from the laws of physics. Maybe you
don’tlike the word “horology”. I’m open to suggestions for a better term of art. 

But I hold fast to the idea that an atomic clock measures time and durations in one way and a calendar measures these
ina different way. Seems to me that the whole business of calendars is nicely captured by the term “cultural”. 

Maybe I could use the terms “atomic clock time” and “calendar time”.

The “to_timestamp()” built-in function maps from “atomic clock time” to “calendar time”. And the “extract… epoch…”
constructmaps from “calendar time” to “atomic clock time”. 

Think of it like this: if you add the interval “24 hours” to a moment just before the US “spring forward” moment (using
timestamptzand, say “US/Pacific" time zone), then you get one answer, But if you do the same exercise using the
interval“1 day”, then you get a different answer. Tom Lane has said that this is intended. You need a vocabulary that
yourinner voice can use when you decide, in the present application context, which of these is required. You can’t
possiblyrehearse the whole discussion about atomic clocks and calendars every time this question comes up. Rather, you
needterms of art to support your thinking. For example: 

«
In the following, “interval arithmetic” denotes “t2 := t1 + i” (addition) and “i := t2 - t1” (subtraction).

Interval arithmetic always uses cultural semantics for years and months. And it always uses horological semantics for
hours,minutes and seconds*. Interval addition for days uses cultural semantics. But interval subtraction for days uses
horologicalsemantics. 

* This is in the calendar regime where leap seconds are not accounted for.
»

You can’t write something like this without terms of art to support you.

Thanks again for your helpful insights. I’ll stop now.


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Upgrading from 11 to 13
Next
From: Ron
Date:
Subject: Re: Upgrading from 11 to 13