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 ad4LLgCU018QXQAA0tVLHw (envelope-from ) for ; Fri, 11 Dec 2020 15:45:04 +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 sM3QKQCU01+0fAAA1q6Kng (envelope-from ) for ; Fri, 11 Dec 2020 15:45:04 +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 10AAF940367 for ; Fri, 11 Dec 2020 15:45:04 +0000 (UTC) Received: from localhost ([::1]:33808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1knkbO-0008B9-I6 for larch@yhetil.org; Fri, 11 Dec 2020 10:45:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knkWz-0004gS-Bk for emacs-orgmode@gnu.org; Fri, 11 Dec 2020 10:40:29 -0500 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:45110 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1knkWw-0002rE-Cf for emacs-orgmode@gnu.org; Fri, 11 Dec 2020 10:40:29 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1knkWs-00012s-T3 for emacs-orgmode@gnu.org; Fri, 11 Dec 2020 16:40:22 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: org-table change time from UTC to other timezones Date: Fri, 11 Dec 2020 22:40:17 +0700 Message-ID: References: <87wnxrjjl2.fsf@gmail.com> <87lfe5ju0t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.70 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); 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: 10AAF940367 X-Spam-Score: -1.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: AxkU8YKmIjri 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). Carefully choose storage format: - just Date e.g. for date of birth (adding time or time zone could distort results), - Date + LocalTime + Place for planned events - Timestamp for most events in past. Use it for future if local time is irrelevant, astronomical events is an example. Conversion to local time could evolve due to administrative decisions. Examples when Olson DB is not enough and additional negotiations or justifications are necessary: - (March, 31) - (1 month) - Conversion from Date + LocalTime to Timestamp around time transition when non-existing or ambiguous local time is possible.