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: encode-time vs decode-time Date: Wed, 07 Aug 2019 13:41:49 +0200 Message-ID: <87o9119p8i.fsf@mouse.gnus.org> References: <502b23f8-58ed-38ff-ae50-fae391129a10@cs.ucla.edu> <87v9viuivo.fsf@mouse.gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="7398"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Andy Moreton , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 07 13:42:05 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 1hvKKS-0001nv-Pj for ged-emacs-devel@m.gmane.org; Wed, 07 Aug 2019 13:42:04 +0200 Original-Received: from localhost ([::1]:40010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvKKR-0004QJ-OI for ged-emacs-devel@m.gmane.org; Wed, 07 Aug 2019 07:42:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56849) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hvKKM-0004MB-FC for emacs-devel@gnu.org; Wed, 07 Aug 2019 07:41:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hvKKK-0006tS-CS for emacs-devel@gnu.org; Wed, 07 Aug 2019 07:41:58 -0400 Original-Received: from ryder.getmail.no ([84.210.184.14]:47343) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hvKKK-0006rn-6K for emacs-devel@gnu.org; Wed, 07 Aug 2019 07:41:56 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by ryder.getmail.no (Postfix) with ESMTP id C4CEF62CF2; Wed, 7 Aug 2019 13:41:51 +0200 (CEST) Original-Received: from ryder.getmail.no ([127.0.0.1]) by localhost (ryder.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id oPj1DQdHnjiV; Wed, 7 Aug 2019 13:41:50 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ryder.getmail.no (Postfix) with ESMTP id 717E462D8E; Wed, 7 Aug 2019 13:41:50 +0200 (CEST) X-Virus-Scanned: amavisd-new at ryder.getmail.no Original-Received: from ryder.getmail.no ([127.0.0.1]) by localhost (ryder.get.c.bitbit.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SEpu56uyfWrQ; Wed, 7 Aug 2019 13:41:50 +0200 (CEST) Original-Received: from sandy (cm-84.212.202.86.getinternet.no [84.212.202.86]) by ryder.getmail.no (Postfix) with ESMTPSA id 0DAEE62D87; Wed, 7 Aug 2019 13:41:50 +0200 (CEST) In-Reply-To: (Paul Eggert's message of "Mon, 5 Aug 2019 18:48:21 -0700") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 84.210.184.14 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:239218 Archived-At: Paul Eggert writes: > OK, after some cogitation I installed something along those lines into > master. I called the new function 'time-convert' by analogy with the > existing functions time-add etc. So now, as you suggested, encode-time > has reverted to its old role of converting from decoded timestamps to > Lisp timestamps and its API is now simpler. Great! Thanks for doing this and adding the sub-second time to the decoded time structure -- I'll be implementing the remaining bits of the ISO 8601 standard in `iso8601-parse' (the ones that deal with fractional seconds) so that we'll have a completely compliant parser. > I didn't follow Stefan's suggestion of adding another function that > acts like current-time except it returns the (TICKS . HZ) format, > because current-time is already planned do exactly that after the next > release (when we will default CURRENT_TIME_LIST to false) and it'll be > simpler if we have one function rather than two that do the same > thing. However, I think this sounds overly ambitious. I think it's likely that there's tons of out-of-tree code that assumes that `current-time' always returns a list of time values, because it's been that way since basically forever. It's been extended, but the first two elements have always been a representation of seconds. This is why I thought it would be good to introduce a new function, say `get-current-time', that could have our new signature. We'd then deprecate `current-time' (but probably never actually remove it since there's so much code out there in the wild that uses it) and rewrite all calls in-tree to use this new function. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no