From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: encode-time vs decode-time Date: Tue, 30 Jul 2019 17:50:11 -0500 Message-ID: References: <502b23f8-58ed-38ff-ae50-fae391129a10@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="106074"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen , Andy Moreton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 31 00:50:40 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 1hsax5-000RTg-Uu for ged-emacs-devel@m.gmane.org; Wed, 31 Jul 2019 00:50:40 +0200 Original-Received: from localhost ([::1]:36682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsax4-00056x-Tj for ged-emacs-devel@m.gmane.org; Tue, 30 Jul 2019 18:50:38 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46077) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hsawm-00055X-Hk for emacs-devel@gnu.org; Tue, 30 Jul 2019 18:50:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hsawl-0002na-9e for emacs-devel@gnu.org; Tue, 30 Jul 2019 18:50:20 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:33128) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hsawl-0002jS-27 for emacs-devel@gnu.org; Tue, 30 Jul 2019 18:50:19 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4CC671626E3; Tue, 30 Jul 2019 15:50:17 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Ch6AOFImvzSv; Tue, 30 Jul 2019 15:50:16 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F26EF1626E6; Tue, 30 Jul 2019 15:50:15 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lAPTOgly1qDs; Tue, 30 Jul 2019 15:50:15 -0700 (PDT) Original-Received: from [192.168.0.8] (ip72-206-6-38.fv.ks.cox.net [72.206.6.38]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A38411626E3; Tue, 30 Jul 2019 15:50:15 -0700 (PDT) In-Reply-To: <502b23f8-58ed-38ff-ae50-fae391129a10@cs.ucla.edu> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 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:239042 Archived-At: On 7/30/19 12:54 PM, I wrote: > > So, how about this idea. First we go along the lines of your=20 > suggestion, and change decode-time to return a ninth slot with a=20 > numerator-denominator pair that preserves all the precision of its=20 > argument. Second, we change (encode-time TIME t) so that it also=20 > preserves all the precision of its argument. This will cause=20 > (encode-time (decode-time TIME) t) to return a value equivalent to=20 > TIME, which will simplify roundtripping. Come to think of it, we would also need to change this obsolescent API=20 for encode-time: > As an obsolescent calling convention, if this function is called with > 6 or more arguments, the first 6 arguments are SECOND, MINUTE, HOUR, > DAY, MONTH, and YEAR, and specify the components of a decoded time, > where DST assumed to be -1 and FORM is omitted.=C2=A0 If there are more > than 6 arguments the *last* argument is used as ZONE and any other > extra arguments are ignored, so that (apply #'encode-time > (decode-time ...)) works; otherwise ZONE is assumed to be nil. Several places in the code use this obsolete API and do (apply=20 #'encode-time FOO) where FOO is either the munged result of an earlier=20 decode-time or is created from scratch. So, if we made the change as=20 described above, we'd also need to change the obsolescent API to be=20 something like this: "As an obsolescent calling convention, if this function is called with 6=20 or more arguments, the first 6 arguments are SECOND, MINUTE, HOUR, DAY,=20 MONTH, and YEAR, and specify the components of a decoded time, where DST=20 assumed to be -1 and FORM is omitted. If there are between 7 and 9=20 arguments the *last* argument is used as ZONE and if there are 10=20 arguments the 9th is used as ZONE and the 10th as a fractional-second=20 argument (TICKS . HZ) and in either case any other extra arguments are=20 ignored, so that (apply #'encode-time (decode-time ...)) works. In this=20 obsolete convention, the default=C2=A0 ZONE is nil and the default fracti= onal=20 second is zero." Good thing that API is "obsolescent"....