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: Decoded time accessors Date: Sun, 07 Jul 2019 22:09:21 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="25483"; 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 Sun Jul 07 22:10: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 1hkDUd-0006M9-GX for ged-emacs-devel@m.gmane.org; Sun, 07 Jul 2019 22:10:39 +0200 Original-Received: from localhost ([::1]:36874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkDUW-0004Et-Rd for ged-emacs-devel@m.gmane.org; Sun, 07 Jul 2019 16:10:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56979) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hkDTU-0004CQ-Fx for emacs-devel@gnu.org; Sun, 07 Jul 2019 16:09:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hkDTS-0001uE-NF for emacs-devel@gnu.org; Sun, 07 Jul 2019 16:09:28 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:38780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hkDTS-0001tm-GV for emacs-devel@gnu.org; Sun, 07 Jul 2019 16:09:26 -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 1hkDTO-0001qp-3j; Sun, 07 Jul 2019 22:09:24 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEXLysry8vLw8PDb2tg1 NTXMzMz5+fjp6ej////Pz8/Jycn+/v329vXu7u2zs7P79ZBiAAACVUlEQVQ4jcWSsWsUQRTGB44r ct2bIgq5K2YaG6ca0MZyK4sjIFtcmWYIZNNE8ApzRWLhwHrVEWG7g5DCLQQRzMFisQjPQKbZba4I U4tN/gbf7O2p6Glh48eyDPvb9773vV0W3f6qPM/j+C2LZlqPSUcGjXMHxnwwWCTukkVvMkJaP3Sl gZKYcX2677HoIms0uw+JlAEAhIsNJbTqJ6o2fQIllu6ARaO2QkLiPdK7lTJSXLFozlgvn7OOgAQA oW+WEgcB5IzRgPNOVSPU6JduOUEOV2woALgQwKV0lXDwGZc1KknArBT6cG6AO1kjJxB1szjuxvET AFeBUUv03ox949EjD7blvYMyGRw5QYyvAWNbSrmBd6pyE4l18GjjcQmOotQCQw6aKtrKYsp41hmP ZXOhqrZ98JgH72zWDmcOHZ8YKVfJ2Sie2VYnqDyGVq1Hfw1OnRzQYgi4lcLDdMfaqeMKy5Jatcu1 9lXt93bsifMTFGGJXUa5dzv247g+1I/Io1a0/NacsY799OCe1s/t1Axq/D7Vbu/cXj7V+mZhT5F7 48S6Iieg9XGxsFOUYccELsiB9c7TD/rm8btrqhAcoUk+imOqSIvrYqyP7alRk+2VOVXkARR39DMb KpQBeTdUnIUKW7zXr0PyRApsPPJuTF+EwIvbLwSmpqoQwrgXo4zcO9a+/LoTlmgGfBUwZ10al4Dd b5ZovEJe7Qfz7Iz+hR9r5wIF7LNhsdIapAs6U1A2tJv1L2DxP1ulf261EW0GaQDFIt3k/5epit+e LVoQ1JzT4qfqbzgfHcee0QR5AAAAAElFTkSuQmCC In-Reply-To: (Paul Eggert's message of "Sun, 7 Jul 2019 12:52:34 -0700") 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:238396 Archived-At: Paul Eggert writes: > Lars Ingebrigtsen wrote: >> I hate reading code that says (elt decoded 5) and then >> have to look up the doc string and then count to be able to tell what >> it's doing > > I dislike that too. Luckily, it doesn't happen too often for me. I try > to avoid it by using format-time-string instead of decode-time. Yup, but when writing code to manipulate times, it's often easier to work on the decoded time instead of manipulating the other time forms. (For instance, getting "next day at the same time" is much easier in decoded time, because that can be 23, 24 or 25 hours depending on DST...) > What do Common Lisp hackers do? Common Lisp has a similar function > decode-universal-time, so they must have a similar problem. Yup. I can only speak for myself, and we ended up with similar things to what I'm proposing, only... more organically grown over the years. :-) > Where in the source code would you put the accessors? I was looking around in the tree, and I haven't really found a good place to put them... parse-time.el isn't basic enough, and the really base time functions are in C. So... perhaps simple.el? Or a new file, decoded-time.el? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no