From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: calculating relative time until a day of week Date: Sun, 7 Jul 2024 07:10:48 +0200 Message-ID: References: <87v81itfvs.fsf@librehacker.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xY6+vYHD/tUtQLt3" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39806"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs Mailing List To: Christopher Howard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 07 07:11:45 2024 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 1sQKBd-000AA8-4y for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 07 Jul 2024 07:11:45 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sQKAt-0007Wy-9m; Sun, 07 Jul 2024 01:10:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQKAn-0007WW-Hs for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 01:10:54 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQKAm-0004uk-4W for help-gnu-emacs@gnu.org; Sun, 07 Jul 2024 01:10:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UWeBx7nKTEU0rUpLkBRI4nLJmTk6TS/Q8kask/rFjWI=; b=S0Kjiy5cHCFXQprE03KcGfUG/q GEx1VwhYo9YvcqZggOsitH/d26gnWP348EvykMXtrkGwY/YztOoJNsxF6QdM/A5Lb0zPXND0sAWfI VaBc3q4FXUSCYaZsDqxj231O0uQ6qMCDGEV6ArA7IDqy6JvxlW8eOSvRUEmDIMyGaa7IyDjN/6q9T 9jX16WqBbTzFAXrBV7xvB4TA9bnd80k3ocpSeof+0v1bCF6sq9P3Ud+TKWnBD/nUm/7ktbQR6Gw6N t/PNlBSiJtN/srle56zL8rWXWPvJnWn/hGBOBk0k2BJFVpHw8r3Q4fF4XIdhJYo56kT/2Tg635OnY +dBFJKYA==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1sQKAi-00032e-Rn; Sun, 07 Jul 2024 07:10:48 +0200 Content-Disposition: inline In-Reply-To: <87v81itfvs.fsf@librehacker.com> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147096 Archived-At: --xY6+vYHD/tUtQLt3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 06, 2024 at 12:38:47PM -0800, Christopher Howard wrote: > Hi, I want to make an Emacs timer that runs a command once a week, every = Tuesday at 4am. I could do this with run-at-time and a relative time, but I= would need to calculate how many seconds until Tuesday 4am. Is there an ea= sy way to calcuate that? (time-subtract (date-to-time "2024-11-13T10:22:00+0100") (current-time)) Note that Emacs's internal time representation is "abstract" -- you shouldn't rely too much on its details. But you have a set of functions to operate on it and to move from/to human readable representations. See all the chapters on time in Elisp's "System Interface" section, especially "42.8 Parsing and Formatting Times" and "42.10 Time Calculations". Cheers --=20 t --xY6+vYHD/tUtQLt3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZoojUgAKCRAFyCz1etHa RnPLAJ4/DXd3P0wrZY+Lai3YQVhPyX/VTwCePSXJikBQzZ/fSJVDdCbrZiR1Yus= =aheY -----END PGP SIGNATURE----- --xY6+vYHD/tUtQLt3--