GNU bug report logs - #71572
[PATCH] seconds-to-string-approximate

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Sat, 15 Jun 2024 17:25:01 UTC

Severity: wishlist

Tags: patch

Merged with 71573

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: JD Smith <jdtsmith <at> gmail.com>
Subject: bug#71572: closed (Re: bug#71572: [PATCH] seconds-to-string-approximate)
Date: Sat, 21 Dec 2024 10:33:03 +0000
[Message part 1 (text/plain, inline)]
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 71572 <at> debbugs.gnu.org.

-- 
71572: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71572
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: john muhl <jm <at> pub.pink>
Cc: adam <at> alphapapa.net, jonas <at> bernoul.li, 71572-done <at> debbugs.gnu.org,
 jdtsmith <at> gmail.com, eggert <at> cs.ucla.edu
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
Date: Sat, 21 Dec 2024 12:32:04 +0200
> From: john muhl <jm <at> pub.pink>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  Adam Porter <adam <at> alphapapa.net>,
>   71572 <at> debbugs.gnu.org,  Jonas Bernoulli <jonas <at> bernoul.li>,  Paul Eggert
>  <eggert <at> cs.ucla.edu>
> Date: Sun, 15 Dec 2024 17:26:04 -0600
> 
> JD Smith <jdtsmith <at> gmail.com> writes:
> 
> >  On Dec 8, 2024, at 4:17 AM, john muhl <jm <at> pub.pink> 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.

[Message part 3 (message/rfc822, inline)]
From: JD Smith <jdtsmith <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Adam Porter <adam <at> alphapapa.net>, jonas <at> bernoul.li
Subject: [PATCH] seconds-to-string-approximate
Date: Sat, 15 Jun 2024 13:24:00 -0400
[Message part 4 (text/plain, inline)]
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.

[seconds-to-string-approximate.patch (application/octet-stream, attachment)]

This bug report was last modified 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.