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 sequence of times Date: Wed, 16 Dec 2020 10:05:54 +0100 Message-ID: References: <878s9y8fy5.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="10139"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 16 10:07:59 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 1kpSms-0002Wt-Uh for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 10:07:58 +0100 Original-Received: from localhost ([::1]:37956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kpSms-0002Sf-0N for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 16 Dec 2020 04:07:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpSlR-00027f-TJ for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:06:29 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:37401) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kpSlP-0005ov-GP for help-gnu-emacs@gnu.org; Wed, 16 Dec 2020 04:06:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1608109554; bh=cqqsKSxMAblwjbmbgOt3oqpFmCJgGILhNPXgBluwiY8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lc562HHLc+hrksWbQ1f6sQ7oRaMv8L+yGySL1HA0bViXzISI3WYdt/VaR7TmHpnuZ p4VtN/zmuj5BsaJr8XCuSa1lwQe1I+IMBEm+2iHTryx/3CDRSekcyplEEF7VVUoL/h LtyppNjvfn9rA3e93qFCROS+UkzTO0vYP59JGvsw= 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 10:05:54 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:mqkhpdTxd5jGaQDFG08oLFMzdbCCCd1kxFNIVbnQbGMsiLCZkGlFcx7kJmUcEEMZA1hpk wjKu8HRE5zBCxZyQwKPi+XRq16igPwzN7jPvQckKg5u8gL9qQMyUn4L03Sfx/HFR3Xiuv9OqGttR 8i5mgJvruWGS6w2NhzLpI4ytjrlHsIWBpU24gnQ9LiHAJpMhqKsCP8pr87nn1rE4exc32lcEjWkn aRB3ayL1cr1KBu4ilqLnlcxIdgV9IaWCvAoR4fUXcLHODkgOmahQnZB8WNAGuJErcuJLDv63w+GJ 1U= X-UI-Out-Filterresults: notjunk:1;V03:K0:7r/xsVDOa6A=:Cj3LdUY/jEUInxuBa4t5gc Qa+CpARqWyiGLeGxBPMnu95eqYlV4DzB/KVVRLDZxuEjnBPTR9YHh/PTMD5WThHf9SdPzrJg7 VTcQ0irwNc/noCMuzWfGSz+xoyslzdBstS8Q3zEoG6Q9Vq7g0u992Dmne+oTgvyNMGjAcPszu Z0txMMVYKIHJ1jV7XnP6gbcfzG4CaIt4W6Zr+tfYDyToknl0w3Hck6AmXO5PEIuwATbxWVoI2 e9mvBXkjaMxWg3OvtKRGWJzF0Fd1J+l2gJOeiXeBF9MYw/yHXQSBAS8bes+m2fLLceYvMPePR V3HZn2KqvxwsC1aD6LtkJt6pf3QLo4+gwvkDARAyr3GAv4A4DzAdy92Tc1L5CxdrZHwHXj+eY 27NViVekHJQQTOW8VIqHQwL0bwkPKYBcUfRghBZDUEOvK5zx2hcs7xFxNn7md1rT1vGeF2IIi ttxJZ/btcoeFetIgLw4bxGX1HBEk6IOwk+DGV26gcAYZZHrG54yCRs6gkDwqBp/DJ/k7ylxQB rZuNodQfs5V7o8RCQ2JUHyMDaG6guUuPbrNkSy6EJX9sElAn23RFaPdk1/iboApLPbybnxddv gvq7FgoLAwR6I= Received-SPF: pass client-ip=212.227.17.22; 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:126414 Archived-At: I have done something like this, but need help to finalise the actual funct= ion=2E Do you agree on this solution? (defun timfutur () (interactive) (setq tm 845) (setq tsk 30) (setq thr (/ tm 100)) (setq tmn (- tm (* thr 100))) (setq tmn-futur (% (+ tmn tsk) 60)) (setq thr-futur (% (+ (/ (+ tmn tsk) 60) thr) 24)) (message "%d %d %d%d" thr tmn thr-futur tmn-futur)) > Sent: Wednesday, December 16, 2020 at 9:01 AM > From: "Jean Louis" > To: help-gnu-emacs@gnu=2Eorg > Subject: Re: Elisp - Function returning a sequence of times > > * Emanuel Berg via Users list for the GNU Emacs text editor [2020-12-16 08:53]: > > Jean Louis wrote: > >=20 > > > I am using external tools > >=20 > > Me too, here is some zsh: > >=20 > > https://dataswamp=2Eorg/~incal/conf/=2Ezsh/time > >=20 > > and a screenshot: > >=20 > > https://dataswamp=2Eorg/~incal/pimgs/comp/clocks=2Epng >=20 > Looks like prompt, is it? Huge calendar prompt=2E OK fine=2E Could be al= so > used to show upcoming appointments=2E >=20 > Emacs must have those date/time features and adding times > somewhere=2E But where? >=20 > (info "(elisp) Time Calculations") >=20 > time-add is a built-in function in =E2=80=98src/timefns=2Ec=E2=80=99=2E >=20 > (time-add A B)=20 >=20 > In the manual there is more references: >=20 > (let ((time (decode-time nil nil t)) > (delta (make-decoded-time :month 2))) > (encode-time (decoded-time-add time delta))) >=20 > (make-decoded-time :hour 10 :minute 20) =3D> (nil 20 10 nil nil nil nil = nil nil) >=20 > This adds 360 seconds to current-time: > (time-add (current-time) 360) >=20 > (defun my-days (days) > "Returns seconds for days" > (* 24 3600 days)) >=20 > (defun my-minutes (minutes) > "Returns seconds for minutes" > (* 60 minutes)) >=20 > (my-minutes 35) > 2100 >=20 > (format-time-string "%H:%M" (current-time)) > "10:57" >=20 > (time-add (current-time) (my-minutes 35)) > (24537 50767 754967 229000) >=20 > (format-time-string "%H:%M" (time-add (current-time) (my-minutes 35))) > "11:33" >=20 > So adding works in plain Emacs=2E >=20 > What I do not know is how to convert 10:57 time to TIME format > like: (24537 50767 754967 229000) >=20 > And because function requires only time as hours and minutes, the > date would not matter=2E >=20 > Once that is found, how to convert any TIME:MINUTES to that TIME > format: (24537 50767 754967 229000) then it will be easy to make > function that adds minutes or specified hours or minutes to it > and produces a sequence=2E >=20 > Jean >=20 >=20 >=20 >