Subject: bug#71573: closed (Re: bug#71572: [PATCH] seconds-to-string-approximate)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 21 Dec 2024 10:33:03 +0000

Your bug report

#71572: [PATCH] seconds-to-string-approximate

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
71572: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71572
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
From: Eli Zaretskii <[email-masked]>
To: john muhl <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked], [email-masked]
Date: Sat, 21 Dec 2024 12:32:04 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: john muhl <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  Adam Porter <[email-masked]>,
>   [email-masked],  Jonas Bernoulli <[email-masked]>,  Paul Eggert
>  <[email-masked]>
> Date: Sun, 15 Dec 2024 17:26:04 -0600
> 
> JD Smith <[email-masked]> writes:
> 
> >  On Dec 8, 2024, at 4:17 AM, john muhl <[email-masked]> wrote:
> >
> >  Thanks for working on this. I gave a quick try and noticed some
> >  amounts aren’t pluralized how I expect; e.g.
> >
> >   (seconds-to-string 36541462 'expanded nil 1)
> >   ;; "1 year 1.9 month"
> >
> > Thanks again.  This was another small bug in the units for the first expanded
> > term.  Corrected (final?) patch attached.  Could you please give another quick
> > test?
> 
> Works for all my test cases. Thanks.

Thanks, now installed on master, and closing the bug.

Subject: [PATCH] seconds-to-string-approximate
From: JD Smith <[email-masked]>
To: [email-masked]
Cc: Adam Porter <[email-masked]>, [email-masked]
Date: Sat, 15 Jun 2024 13:24:00 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

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.