Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> adrian.klaver@xxxxxxxxxxx wrote:
> 
> The point is horology is cultural, see non-Western calendars and alternate time keeping methods. Trying to maintain a distinction between 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 (in other 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’t like 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 in a 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…” construct maps 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 timestamptz and, 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 your inner voice can use when you decide, in the present application context, which of these is required. You can’t possibly rehearse the whole discussion about atomic clocks and calendars every time this question comes up. Rather, you need terms 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 horological semantics.

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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux