emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Maxim Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-table change time from UTC to other timezones
Date: Sat, 12 Dec 2020 06:31:06 +0300	[thread overview]
Message-ID: <X9Q5egEa02bgk+4H@protected.rcdrun.com> (raw)
In-Reply-To: <rr03t2$3j7$1@ciao.gmane.io>

* Maxim Nikulin <manikulin@gmail.com> [2020-12-11 18:45]:
> 2020-12-11 Alan E. Davis wrote:
> > 
> > I had hoped that subtracting 10 hours from 06:44 UTC would get me at
> > least -04:44.
> 
> I am in doubts how to present negative time correctly. Having in mind wall
> clocks with hands, your expectation has some sense.
> 
> I think, the source of confusion is that you are trying to use facilities
> intended for TimeInterval + TimeInterval arithmetic, where TimeInterval
> denotes a type. Actually you need to compute Time + TimeInterval. Sorry, I
> am unaware if Emacs provides proper functions.
> 
> There are a lot of subtle issues with time-related operations, but most of
> DST complications pointed out by Tim could be handled with IANA (Olson) DB
> for time zones, on Linux it is almost always installed as tzdata package and
> is getting regular updates. It is rather precise and contains history of DST
> and other transitions. If people complains on incorrect results, usually
> they have wrong timezone set on their computers.
> 
> For astronomy the best representation should be timestamp (seconds since
> epoch) converted to local date time when necessary. Unsure concerning leap
> seconds.
> 
> Human-related future events mostly should be stored as date + local time +
> label of administrative region that allows to get time zone ID (namely ID,
> not offset from UTC). Time offset could be changed after event has been
> planned, time zone could be split into several ones with distinct offsets.
> 
> - LocalTime + TimeInterval operation could give incorrect result unless
> LocalTime is augmented with date and TimeZone, the latter is the history of
> transitions.
> - TimeZone (e.g. Europe/Berlin) as full transition history is not the same
> as TimeOffset at particular moment (+0100).

Let me just comment that PostgreSQL database has date/time types such
as:

TIMESTAMP WITHOUT TIME ZONE and
TIMESTAMP WITH TIME ZONE

but all of them are stored without time zone, the difference being
that "WITH TIME ZONE" would only be displayed with specific time
zone.

Same approach can be used in other time storages, just store it as
UTC, display it as you wish.

Jean


      parent reply	other threads:[~2020-12-12  3:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 10:20 Alan E. Davis
2020-12-09 11:34 ` Tim Cross
2020-12-10  8:10   ` Alan E. Davis
2020-12-10 19:01     ` Tim Cross
2020-12-11  0:12       ` Alan E. Davis
2020-12-11 15:40         ` Maxim Nikulin
2020-12-11 22:44           ` Alan E. Davis
2020-12-12 16:04             ` Maxim Nikulin
2020-12-12 22:52               ` Tim Cross
2020-12-13  3:14                 ` Alan E. Davis
2020-12-13 17:03                   ` Maxim Nikulin
2020-12-14  2:29                     ` Alan E. Davis
2020-12-12  3:31           ` Jean Louis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9Q5egEa02bgk+4H@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    --subject='Re: org-table change time from UTC to other timezones' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).