From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 5g24B/m50l/sXQAA0tVLHw (envelope-from ) for ; Fri, 11 Dec 2020 00:14:49 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id aDzvAvm50l9CLwAAbx9fmQ (envelope-from ) for ; Fri, 11 Dec 2020 00:14:49 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5A734940355 for ; Fri, 11 Dec 2020 00:14:48 +0000 (UTC) Received: from localhost ([::1]:52160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knW57-0006Fc-Pi for larch@yhetil.org; Thu, 10 Dec 2020 19:14:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knW42-0006F6-32 for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 19:13:39 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:41738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knW3y-00087Q-Bw for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 19:13:37 -0500 Received: by mail-wr1-x42d.google.com with SMTP id a12so7274935wrv.8 for ; Thu, 10 Dec 2020 16:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vmhO/flzIYdmZA+GKatl1V7O8G5HQ43llVJKamPUR6w=; b=O9/HIVrRDOrKzlWU93rzjYlov/uK1TA7lZCSO4w/X8yhJAm90WwO10kWdSugNIGF8s /0S+c3sU4nJSlmlT/m28fjzzy/A5ovwtC8QOUmbS+m8w/WstR6oegbxdsknXaMl8l4bW s5ryEm2p9LOI446KVUyddzBkTRUKTgjppiLjtGwTu8LR3bi35plw6VaWsNnTsOJKk7hw CIbIh/WW/VKSzCQsVfm0Ql3+67eMNSFWLMf5SmyZx7jCr/HFqgOdaQQ6rxDHSIi60QAw GrDiAKqhPO4rKBtFdRs765wZj7gCBOi1OJH6vnBue1zBYc3YK8BgLCqxyHy0i5ZVMwRe j04w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vmhO/flzIYdmZA+GKatl1V7O8G5HQ43llVJKamPUR6w=; b=IGBQ++aZD0BxP5YtzD1ZbDLPyu9I1H6TJj5ZggTwWOYvAcZw370pydedE14k5E2Qic V4FtvYca6veL+/OHsSfos54tQPOSjNIV/rdLi42h3E0iElBmCZKNuLcmQ4J+m5COouFa By+04hXbJIPtRCgVkdRZVSJUUV0kwX0PiYn4fbN9V5rEC22uwi6w8HTTsaKCX8mkpSrT yficyVLfEB75gGI6LoTxUlxgKs++rUP6QVFGfZiJatx//dG6cuaVvHOd5yxqaL2uQOR2 d6/1oqrsYZ//PVBzq+C+dXh42cL1PA8J2ZVLKfM3/qomC3/SI7WORB30J0e4hB/mFhRD 0PMQ== X-Gm-Message-State: AOAM530MJWCVu+gmix8OwhGLuT0x8/Xai5ueBOlJ0yh588LrbhCZwbcX fq+L4f18G4g/mH5/J5/pz5PMqSqik35x6HVE3WRemULaHlY= X-Google-Smtp-Source: ABdhPJzt6ve3y2bh/cNq4T1s/Ehj6iIE/siR8akY9e6p8p1+86Z4LX98L8VVneZe3JjiY3EJ+8X9CRw90ghRJ15lEFQ= X-Received: by 2002:a5d:4d4f:: with SMTP id a15mr10858588wru.315.1607645611857; Thu, 10 Dec 2020 16:13:31 -0800 (PST) MIME-Version: 1.0 References: <87wnxrjjl2.fsf@gmail.com> <87lfe5ju0t.fsf@gmail.com> In-Reply-To: <87lfe5ju0t.fsf@gmail.com> From: "Alan E. Davis" Date: Thu, 10 Dec 2020 16:12:51 -0800 Message-ID: Subject: Re: org-table change time from UTC to other timezones To: Tim Cross Content-Type: multipart/alternative; boundary="0000000000009e991105b62529a9" Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=lngndvs@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FROM_LOCAL_NOVOWEL=0.5, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=0.344, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URI_DOTEDU=1.999 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.00 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=O9/HIVrR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 5A734940355 X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: J0zV4K54HymO --0000000000009e991105b62529a9 Content-Type: text/plain; charset="UTF-8" Thank you for taking the time to answer my questions, TIm. For my purposes, it's maybe easier to just bite the bullet and do it in my head. I had hoped that subtracting 10 hours from 06:44 UTC would get me at least -04:44. I can easily make the change to correct clock time (19:44) and change the day name. I was duplicating the work of looking up the time in XEphem, the ephemeris program I am using, which requires some amount of fiddling---solving for the time of max/min lunar declination. It will save hours of time to use org-mode's spreadsheet to add/subtract the Timezone offsets. As it turns out, this is not a straightforward procedure. Also, as you point out, this process is even less convenient due to inconsistencies in the political realm. I appreciate your comments. Alan Davis On Thu, Dec 10, 2020 at 12:17 PM Tim Cross wrote: > > Alan E. Davis writes: > > > I am close to throwing in the towel. > > > > Thank you for the suggestion. Several problems have been encountered. I > > wonder whether I understand this tool at all. If I subtract 10:00 from > > 08:46, the answer given is -01:14. I used #+TBLFM: $6=$4+$5;U, as > follows > > (please forgive the formatting): > > > > | Phenom | Date | DoW | UTC | Hrs | ChST | | > > |--------+--------+-----+-------+--------+--------+---| > > | ApoG | 22 | Fr | 06:44 | -10:00 | -03:16 | | > > |--------+--------+-----+-------+--------+--------+---| > > #+TBLFM: $6=$4+$5;U > > > > When I add 10:00, I think the values are sensible: 21:45 + 10:00 = 31:45. > > > > What did you expect for 8:46 - 10:00? Looks correct to me or were you > expecting 22:46 (24:00 - 01:14)? This would mean 21:45 + 10:00 should be > 07:45. I think when your working with times like this, you need to > include the date to help make sense of the result. > > > Another problem was in trying to use an inactive org timestamp. It was > not > > straightforward to add or subtract N hours (say, 08:00). > > > > You probably need to use the ort-timestamp-to-time and > org-timestmap-from-time to convert the timestamp to a 'time' value (I > suspect it uses either ms or sec since epoch as the base). Convert to > time, add/subtract offset, convert back to inactive timestamp. > > > This it a thornier problem than I had envisioned, anyway, because in > locale > > with time zones, the conversion factor will change at some point DURING > the > > month. > > > > Perhaps there is a calc procedure to convert time zones that will take > into > > account the system's knowledge of the timezones as well as changes > to/from > > Daylight Time. > > > > For now, > > > > The big pain with working on time and timezones is the daylight savings > complication. This is really tricky because the start and end date tend > to be influenced by politics (I've seen DST change because of some > event, like Olympic games or to coincide with easter holiday etc) and > some states/geographies may decide not to use DST while others do (for > example, in Australia, some states have DST and some don't - so for half > the year, all the eastern states have the same timezone, but then for > half the year, 3 are the same and one is different). > > There is some information in the calendar section of the emacs manual > which might be useful and it does have a section on working with DST > (I've not read it). In addition to the org mode functions to manipulate > dates and times, there are also various elisp functions you can also > use. > > It is a thorny problem because of the edge cases, but the basic > functions are all there. Your best bet is to probably write a function > which accepts a full date+time and UTC offset in minutes which returns a > new date+time value and then call that function in your table formula. > -- > Tim Cross > -- "This ignorance about the limits of the earth's ability to absorb pollutants should be reason enough for caution in the release of polluting substances." ---Meadows et al. 1972. Limits to Growth . (p. 81) --0000000000009e991105b62529a9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for taking the time to answer my questions,= TIm.=C2=A0=C2=A0

For my purposes, it's m= aybe easier to just bite the bullet and do it in my head.=C2=A0
<= div>
I had hoped that subtracting 10 hours from 06:44 UTC wou= ld get me at least -04:44.=C2=A0 I can easily make the change to correct cl= ock time (19:44) and change the day name.=C2=A0 I was duplicating the work = of looking up the time in XEphem, the ephemeris program I am using, which r= equires some amount of fiddling---solving for the time of max/min lunar dec= lination.=C2=A0=C2=A0 It will save hours of time to use org-mode's spre= adsheet to add/subtract the Timezone offsets.=C2=A0=C2=A0
As it turns out, this is not a straightforward procedure.=C2= =A0 Also, as you point out, this process is even less convenient due to inc= onsistencies in the political realm.

I appreciate = your comments.

Alan Davis

On Thu, Dec 10,= 2020 at 12:17 PM Tim Cross <th= eophilusx@gmail.com> wrote:

Alan E. Davis <ln= gndvs@gmail.com> writes:

> I am close to throwing in the towel.
>
> Thank you for the suggestion.=C2=A0 Several problems have been encount= ered.=C2=A0 I
> wonder whether I understand this tool at all.=C2=A0 =C2=A0If I subtrac= t 10:00 from
> 08:46, the answer given is -01:14.=C2=A0 I used #+TBLFM: $6=3D$4+$5;U,= as follows
> (please forgive the formatting):
>
> | Phenom |=C2=A0 =C2=A0Date | DoW |=C2=A0 =C2=A0UTC |=C2=A0 =C2=A0 Hrs= |=C2=A0 =C2=A0ChST |=C2=A0 =C2=A0|
> |--------+--------+-----+-------+--------+--------+---|
> | ApoG=C2=A0 =C2=A0|=C2=A0 =C2=A0 =C2=A022 | Fr=C2=A0 | 06:44 | -10:00= | -03:16 |=C2=A0 =C2=A0|
> |--------+--------+-----+-------+--------+--------+---|
>=C2=A0 =C2=A0 =C2=A0 =C2=A0#+TBLFM: $6=3D$4+$5;U
>
> When I add 10:00, I think the values are sensible: 21:45 + 10:00 =3D 3= 1:45.
>

What did you expect for 8:46 - 10:00? Looks correct to me or were you
expecting 22:46 (24:00 - 01:14)? This would mean 21:45 + 10:00 should be 07:45. I think when your working with times like this, you need to
include the date to help make sense of the result.

> Another problem was in trying to use an inactive org timestamp.=C2=A0 = It was not
> straightforward to add or subtract N hours (say, 08:00).
>

You probably need to use the ort-timestamp-to-time and
org-timestmap-from-time to convert the timestamp to a 'time' value = (I
suspect it uses either ms or sec since epoch as the base).=C2=A0 Convert to=
time, add/subtract offset, convert back to inactive timestamp.

> This it a thornier problem than I had envisioned, anyway, because in l= ocale
> with time zones, the conversion factor will change at some point DURIN= G the
> month.
>
> Perhaps there is a calc procedure to convert time zones that will take= into
> account the system's knowledge of the timezones as well as changes= to/from
> Daylight Time.
>
> For now,
>

The big pain with working on time and timezones is the daylight savings
complication. This is really tricky because the start and end date tend
to be influenced by politics (I've seen DST change because of some
event, like Olympic games or to coincide with easter holiday etc) and
some states/geographies may decide not to use DST while others do (for
example, in Australia, some states have DST and some don't - so for hal= f
the year, all the eastern states have the same timezone, but then for
half the year, 3 are the same and one is different).

There is some information in the calendar section of the emacs manual
which might be useful and it does have a section on working with DST
(I've not read it). In addition to the org mode functions to manipulate=
dates and times, there are also various elisp functions you can also
use.

It is a thorny problem because of the edge cases, but the basic
functions are all there. Your best bet is to probably write a function
which accepts a full date+time and UTC offset in minutes which returns a new date+time value and then call that function in your table formula.
--
Tim Cross


--
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &qu= ot;This ignorance about the limits of the earth's ability to absorb
= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pollutants should be reason enough for= caution in the release
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 of pollutin= g substances."
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0=C2=A0 ---Meadows et al.=C2=A0=C2=A0= 1972.=C2=A0 Limits to Growth. =C2=A0=C2=A0 =C2=A0 (p. 81)=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=
--0000000000009e991105b62529a9--