From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71572: [PATCH] seconds-to-string-approximate Date: Sat, 22 Jun 2024 11:45:22 +0300 Message-ID: <86r0cpicwt.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12858"; mail-complaints-to="usenet@ciao.gmane.io" Cc: adam@alphapapa.net, 71572@debbugs.gnu.org, jonas@bernoul.li To: JD Smith , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 22 10:46:36 2024 Return-path: Envelope-to: geb-bug-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 1sKwOJ-0003Ba-G8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jun 2024 10:46:35 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKwNo-0002K9-Oj; Sat, 22 Jun 2024 04:46:04 -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 1sKwNm-0002Jh-O6 for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 04:46:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKwNm-0008Vv-GR for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 04:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKwNm-0000Aw-5Q for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2024 04:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jun 2024 08:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71572 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71572-submit@debbugs.gnu.org id=B71572.1719045937639 (code B ref 71572); Sat, 22 Jun 2024 08:46:02 +0000 Original-Received: (at 71572) by debbugs.gnu.org; 22 Jun 2024 08:45:37 +0000 Original-Received: from localhost ([127.0.0.1]:44338 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKwNM-0000AE-NJ for submit@debbugs.gnu.org; Sat, 22 Jun 2024 04:45:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45050) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKwNK-0000A1-Ub for 71572@debbugs.gnu.org; Sat, 22 Jun 2024 04:45:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKwND-0008Ow-2o; Sat, 22 Jun 2024 04:45:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=9aD5uk5ae2313Kw03hBKg5dYtZojPx4ohBB/+gJ92ag=; b=LyOHKdU5CnHvAWBh8fln VW8RL+qxDARzBxUD2pZvNABXWZcMSvCC0nQrrMKzea+QyEMHyUX2vR7xXaVJj2vbJfRo9nqm+k6L/ oTUfwzk+BE/isUNG6Zy7QTZiJ8mGX0riAmUdvP4hqLLeaPU5TwhadjKsVQkJJ3ccWtNbR056UAySO bYsa8UHJ6gJb/eBu6Hzv8qE55exgyxO0YRlxhhuk/iTlfybF0RcwWk2gvlmikqMBb6pBQqIkcrJiw QjinC9sZqepJDLYjmPsD2Joy7qtyU9ov+l5XOyZuPAkyWuz2twNvrMHR1/0u+7fEwN22dZn7HyWdu w2EcdZKSgiKDwg==; In-Reply-To: (message from JD Smith on Sat, 15 Jun 2024 13:24:00 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287669 Archived-At: > Cc: Adam Porter , jonas@bernoul.li > From: JD Smith > Date: Sat, 15 Jun 2024 13:24:00 -0400 > > A very useful and widely used time operation is to approximate a given delay or age (in seconds) using a human-readable unit — think "2 hours", "5 days", "3 weeks", or "7 months". We have `seconds-to-string', but it provides more precision than is often required, skips some meaningful "human readable" duration units like weeks and months, and uses abbreviated units exclusively. > > For those familiar with magit, the `magit--age' function has provided this capability for quite some time (e.g. for short commit age), and other packages have adapted it. It would be useful to have a version in core. > > This patch provides a `seconds-to-string-approximate' function based loosely on `magit--age' and `seconds-to-string'. It allows using abbreviated or full units, and can optionally round to the nearest half-unit. Paul, any comments to the patch?