From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id QNeqJD+E0l9ZBAAA0tVLHw (envelope-from ) for ; Thu, 10 Dec 2020 20:25:35 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QP9oID+E0l8APwAA1q6Kng (envelope-from ) for ; Thu, 10 Dec 2020 20:25:35 +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 F0176940355 for ; Thu, 10 Dec 2020 20:25:34 +0000 (UTC) Received: from localhost ([::1]:38902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knSVI-0005Gb-GM for larch@yhetil.org; Thu, 10 Dec 2020 15:25:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knSNH-0001Ba-QQ for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 15:17:15 -0500 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:34011) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1knSNF-0001xw-SC for emacs-orgmode@gnu.org; Thu, 10 Dec 2020 15:17:15 -0500 Received: by mail-pf1-x42c.google.com with SMTP id w6so5204723pfu.1 for ; Thu, 10 Dec 2020 12:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=m4Ts1aBYHSpfxF0pqiSCCO+2F71lh2cES460AggnnbQ=; b=Y+qpgzqp6uwleldip5o9ToZ37A0kORG7SAnt4Fa7aLEXoYfYwsLGQ32A/zMm61yCYG R0ygtrwBPkHBMLsU0zIZRD25jq2bDrETY2oA7U3B5/eh9r8DhU98Uw/zb9uR3SQhwKFT eds/sh5YK6TNaPm5JrnyveXBZ2ZRAMgX54DxAo0tSTWoIwLlFUMYCQwEHFynAKdAiSS8 qV6e1XvnMC7/YySaP4oUGXMz4GuHzvsaDK1P/AQVQ9RK6vFqmjhY0Rx3GpljVwtDgEVi JQPjC4UsB7XqoIpNaFtCC4hzB6cmwfWNQzTH4zUUmKith6IVgKpvnnITYesPjMmnEhsb ZJsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=m4Ts1aBYHSpfxF0pqiSCCO+2F71lh2cES460AggnnbQ=; b=EXiggVbC4CwoIdc6+vXPdA0Ti9MdOiWIsKSrHc+gw+TjW4oX0VLALi7DWWfKUyLFFQ CG7euLqLDJUOcmLnhDr2dxIDF7sEg4Z942YW8xF3IwA3wg572MwIP0Bylb9t7JMDy1T8 WRfnmvDV5z9oZkdBI+YTsme+BfUfMWjxZTljr5gO2GQbb4HvBQ41sOhCQoyMkbwJlECn rFdJdP+dyB8Z6NrHzk3KuxgXQXX6mLwPAgTSDD7v1K5zDtYFGEmpxLHoG0WkuVvPRg/7 Wvmr3N1aH/0jjcx4nk0bNxd7yrzJ/7yvn5c27HTOJBJpcddcKjdCUDh+QDFWDpqVee/Z KvLw== X-Gm-Message-State: AOAM5330gBC4/rtw7Dnrk7prhERwMkjRrZjBoftp3CnRFOhy5RtQxZa9 RVCHlb9fz+ivzRIEaXu1jU/P0giEbpHZnA== X-Google-Smtp-Source: ABdhPJyaXWb6HntK3uHPoYPmQemYRgwsoTgIlpVEWvPixhfecsHvsEfH9Qa03e7OhlutnwYezbnD8Q== X-Received: by 2002:a17:90b:14d3:: with SMTP id jz19mr9448662pjb.196.1607631431626; Thu, 10 Dec 2020 12:17:11 -0800 (PST) Received: from tim-desktop (106-69-97-118.dyn.iinet.net.au. [106.69.97.118]) by smtp.gmail.com with ESMTPSA id 145sm1224298pfu.8.2020.12.10.12.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 12:17:10 -0800 (PST) References: <87wnxrjjl2.fsf@gmail.com> User-agent: mu4e 1.5.7; emacs 27.1.50 From: Tim Cross To: "Alan E. Davis" Subject: Re: org-table change time from UTC to other timezones Date: Fri, 11 Dec 2020 06:01:53 +1100 In-reply-to: Message-ID: <87lfe5ju0t.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=theophilusx@gmail.com; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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=Y+qpgzqp; 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: F0176940355 X-Spam-Score: -3.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: IfFwG88qC2tC 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