From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: steve-humphreys@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Elisp - Function returning a list Date: Wed, 16 Dec 2020 06:20:35 +0100 Message-ID: References: <87o8iu8igd.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14533"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 16 06:22:35 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpPGl-0003fW-OL for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 06:22:35 +0100 Original-Received: from localhost ([::1]:34730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpPGk-00089e-Pt for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 00:22:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpPF0-0007ta-U3 for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 00:20:48 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:37155) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpPEr-0007Zw-DH for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 00:20:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608096035; bh=ODrqOc1SGME6M4KUOlfhCUVV4neZ/NdwzC0KeQ7YEPc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=fyNixnnFGlIB7SJQmBFahtP6SPCmx6J34SXCA9uFKTx6pd/8k80KzryPdeZ85Cj8B U9euZd8geYdxgJbYM6d4cpKz9XMT5VmJKCWrhYKui8el0itrx8qmWG4BYDfDXWSHUY MfqqZmrQ8RYa5fDG/nSVgxRUK4/zTLUWd/bMIHT8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs15.server.lan [172.19.170.183]) (via HTTP); Wed, 16 Dec 2020 06:20:35 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87o8iu8igd.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:s6SjLGXGS54GZBZfkaOdL9xUmy+z/hSRF068HBiaYaM27EGHO7g7hA68cIbjNdQNcYSoj ywyR3cxKl2o9KIijrbo0Xt/DfWAdOz9Gl//XoYq4sdliqIOZ864/1zVhAU5iYq3M98w8JlGnI4Ud 062ajoykEf1RLaPy5rlv/bk182Ffs6UK3OK3wKZ9yazsoSPtfIz8f35lVry/ehGFAvNn5SMZ2Ys/ bler3ksu/st5071Tb4c15298s2rjKdTNisxDfUC86ck7NJjbVWVZaTFbqe6d3g4OZVXHtD1K/guo Ag= X-UI-Out-Filterresults: notjunk:1;V03:K0:th7Oc0bK2yo=:Wg4XKlPAqp4nKSLhOf9U6k YzIDnl32ohDOeGE9dGWRRnWxJevkOenx7XnbZ1nENZewizlnU7na6qGNbZtMdTqCAcRuOuNyG FiM22gNyTSeiYcIjve8n7Nrmpsij4C+3KQwjUh9U7wtU2ZNRbPU+1+CmGmzdH0qPTgx0w64lH wTUoZ3peFgMiniZgzkiMmZYH75x02KfN1KXlP4uReb2ScgOhfUj0aoKzgzEVGn1OKqmiNpsF8 VQtP2aMz/tLFY0kkNFwVMvK0H6jiHGX6X1FVO0DjGjM9WkOAxDxYXcUq+UVeMlWRKh3kSut/a WjbMWuW+pTjm952/ctT5xqHsx6wNpOqM9MWgZYePl2YHXC5DIGE0N5eiHE5Btz8aGD2npNOZJ EgM8hiLiVwBgPkSucpb8crnByNb1RxgGpue4gjCXcg7zKlU37trV7vmP44b2fEhLD2dCRdMFi hKvhgaznFZyBL260yf1X18znzvY1hnBkY0RiQ9paboXP/npd3+DnzfDJu1ONzi7V344IRrDY2 ryVi/mIKV5IBW4mialjk2p/zlrrD8iyjyFYzkgFx2R47IILJV/aJ5geet4W0YpM/xzIdeA6TT roBt3wJyUuaMY= Received-SPF: pass client-ip=212.227.15.18; envelope-from=steve-humphreys@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:126407 Archived-At: > Sent: Wednesday, December 16, 2020 at 5:48 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: Elisp - Function returning a list > > Yuri Khan wrote: > > >> For me 800 is 8 O'Clock > > > > You cannot just do decimal arithmetics on times written in > > that format. > > > > Start: 800 End: 1100 Skip: 45 > > Expected: 800 845 930 1015 1100 > > Actual: 800 845 890 935 980 1025 1070 > > Arithmetics on time? Is that the purpose? Yes, to set the agenda time grid. > If so, check out this: > > ;;; -*- lexical-binding: t -*- > ;;; > ;;; this file: > ;;; http://user.it.uu.se/~embe8573/emacs-init/time-cmp.el > ;;; https://dataswamp.org/~incal/emacs-init/time-cmp.el > > (defun wall-clock-time (h1 m1 s1 h2 m2 s2) > (let*((d 08) ; arbitrary day to use below, any would do > (m 05) ; actually something cool happened that day > (y 1978) ; in the history of climbing > (total-seconds-1 (float-time (encode-time s1 m1 h1 d m y))) > (total-seconds-2 (float-time (encode-time s2 m2 h2 d m y))) > (s-diff (- total-seconds-2 total-seconds-1)) ) > (format-seconds "%.2h:%.2m:%.2s" s-diff) )) > (defalias 'wct #'wall-clock-time) > ;; (wct 09 35 10 23 00 00) ; 13:24:50 > ;; (wct 09 35 10 09 35 20) ; 00:00:10 > > (defun time-between-times (year1 month1 day1 > year2 month2 day2) > (let*((seconds-then (float-time (encode-time 0 0 0 day1 month1 year1)= )) > (seconds-now (float-time (encode-time 0 0 0 day2 month2 year2)= )) > (seconds-diff (- seconds-now seconds-then)) ) > (format-seconds "%yy %dd" seconds-diff))) > ;; (time-between-times 1958 4 13 1958 8 30) ; Tahiti Nui 2 -> 3, > ;; ; i.e. 0y 139d > > (defun get-time-since (year month day) > (interactive "nyear: \nnmonth: \nnday: ") > (message "%s" > (format-seconds > "%yy %dd" > (float-time > (time-since (encode-time 0 0 0 day month year)) )))) > ;; (get-time-since 2011 09 27) ; 8y 228d @ 2020-05-10 > > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > >