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: JD Smith <jdtsmith <at> gmail.com>
To: 71572 <at> debbugs.gnu.org
Cc: Adam Porter <adam <at> alphapapa.net>, jonas <at> bernoul.li
Subject: bug#71572: [PATCH] seconds-to-string-approximate
Date: Sat, 15 Jun 2024 13:24:00 -0400
[Message part 1 (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.