From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Support for sub-second time in decoded time Date: Tue, 30 Jul 2019 13:43:51 +0200 Message-ID: References: <09ec6cb4-af22-52f9-9881-a52f1d0c9cfb@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="226846"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 30 13:44:04 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hsQY0-000wt2-6f for ged-emacs-devel@m.gmane.org; Tue, 30 Jul 2019 13:44:04 +0200 Original-Received: from localhost ([::1]:59972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQXy-00042G-O4 for ged-emacs-devel@m.gmane.org; Tue, 30 Jul 2019 07:44:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55748) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsQXu-000429-HN for emacs-devel@gnu.org; Tue, 30 Jul 2019 07:43:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsQXt-0007kD-0K for emacs-devel@gnu.org; Tue, 30 Jul 2019 07:43:58 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:54386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsQXs-0007jo-QK for emacs-devel@gnu.org; Tue, 30 Jul 2019 07:43:56 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hsQXn-0007F1-Id; Tue, 30 Jul 2019 13:43:54 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUrCQWDGAQOAwPJIwLV JgLXXz9b40YKAAACVElEQVQ4jV2US3IjIQyGJTqzl1DPXsgXAIsDuAuyT01N7n+VEZ3Y8Ri7qwwf evyS2pBwn/fVH7+aAYDKz8F9ZYNkBvpKRlEgs2L7/DzXezx/F0kGsyqnVzACcNKa+ngBEcOgj9br i6tqgGe06+djnWAk2L5A/1/HzLDfQXz8Gcw7GP1ZDX8D2t39GTj0SassDMKnJ7+DpdIsoZW0yZzH d9ARFkzItlGxLVK/GT5czSGxdYIeZ4fqV9DTsnJWQV/mB4J8gZXKESEk8k37oIufkhPsI2y8WZ8N EzfSxuuqwdsCM1OvKzsAk+XqyAGW4mx7Xc3EaizuqyThcb/1atK9qqGEXNOxX8+y35gMnJLa5sJK pSEtMGqOVno2tcLYkBlguRq2wuI4CDUSc9JeS10xrnE1kUeOnAp5Yzm2CtyjPiWXjH4zpkLDWVoh SG/RYM1m0toSyN3z3lABl4qSAQMgMW0yaB9QoMwptWTFzVnZXbxGmQSg9AaAtXBxTtsCDcJVgsuc yCrKpVHo8zCIYRM9wUgbEbToe/dhLZluvJRvBwq3xpGnt6aerEiDqL4E8Ijt65tQspXm0GK4jnRp 0tb1HlBq49HDYkStpY5jwxpDyuC3JrMDMcaN5j7Yr6tDuoo1J5Sr+tVCwW2rV/FxMIeLGLgLMUcn MCrKY83ngT3CTVDVKPvvnxfns07Z6w6WlEzenwjFa2kIRl7F3/HJAldDozD7Ebtf9+OPeGxNmOnO a/vxBPIJ8Mhr++cb/InfJwA0DVoSrkEFu684L5zsIrnwiL+JB/gHNzzIbvr5IfcAAAAASUVORK5C YII= In-Reply-To: <09ec6cb4-af22-52f9-9881-a52f1d0c9cfb@cs.ucla.edu> (Paul Eggert's message of "Mon, 29 Jul 2019 11:46:14 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239027 Archived-At: Paul Eggert writes: > On 7/29/19 4:48 AM, Lars Ingebrigtsen wrote: >> Currently, encoded time has support for picoseconds. `decode-time' will >> throw away all sub-second time, which makes accurate round-tripping >> impossible. > > No, it's quite possible. I meant "round-tripping via the decoded time structure". > Admittedly it is not that convenient. We could extend decode-time to > accept an additional argument FORM that would let the caller specify > the form of the returned value. decode-time could treat FORM much like > encode-time does, and encode-time would be extended to grok the new > forms so round-tripping would be simpler. This would be > upward-compatible with the current behavior. > > For example, under this proposal we'd have: > > (setq R 1000000000) > (setq X (encode-time nil R))=C2=A0 =3D>=C2=A0 (1564418451413082782 . 1000= 000000) > (setq Y (decode-time X nil))=C2=A0 =3D>=C2=A0 ((51413082782 . 1000000000)= 40 9 29 > 7 2019 1 t -25200) > (equal X (encode-time Y R))=C2=A0 =3D>=C2=A0 t As I said in a previous message -- this is very confusing indeed, and I think it should be reworked in a different way before Emacs 27 is released and it's too late to get rid of this confusion. But adding an optional parameter to `decode-time' to also make it include sub-second time in the decoded time structure it returns (also as previously discussed) may be the right thing to do. However, I've grepped through the sources now for usages of decoded time, and it kinda looks to me like adding a ninth slot in decoded time structures would probably not break anything. --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no