From: Eli Zaretskii <eliz@gnu.org>
To: JD Smith <jdtsmith@gmail.com>
Cc: adam@alphapapa.net, 71572@debbugs.gnu.org, jonas@bernoul.li,
eggert@cs.ucla.edu
Subject: bug#71572: [PATCH] seconds-to-string-approximate
Date: Sat, 07 Dec 2024 15:02:15 +0200 [thread overview]
Message-ID: <86jzcbir3c.fsf@gnu.org> (raw)
In-Reply-To: <BE3D8F2C-C67C-4F0B-BF51-B4B049766A77@gmail.com> (message from JD Smith on Sat, 30 Nov 2024 13:58:52 -0500)
> From: JD Smith <jdtsmith@gmail.com>
> Date: Sat, 30 Nov 2024 13:58:52 -0500
> Cc: Eli Zaretskii <eliz@gnu.org>,
> Adam Porter <adam@alphapapa.net>,
> jonas@bernoul.li,
> Paul Eggert <eggert@cs.ucla.edu>
>
> I was recently reminded of the need for a more capable seconds-to-string.
>
> Anyone have any additional comments on this proposed patch? If not, I'd suggest someone with access
> merges.
A few minor nits below, and then we can install:
> --- a/doc/lispref/os.texi
> +++ b/doc/lispref/os.texi
> @@ -2155,6 +2155,12 @@ Time Calculations
> structure. For instance, the 120th day in 2004 is April 29th.
> @end defun
>
> +@defun seconds-to-string delay &optional readable abbrev precision
> +Return a string describing a given @var{delay} (in seconds). Optional
> +arguments can be used to configure a human readable delay using various
> +formats. For example, a delay of 9861.5 seconds with @var{readable} set
> +to the symbol @code{expanded} returns "2 hours 44 minutes".
The strings should be in @samp (and then you can drop the quotes).
> +** Time & Date
> +
> ++++
> +*** 'seconds-to-string' includes new arguments to produce human-readable
> +delay strings in a variety of formats, for example "6 months 3 weeks" or
> +"5m 52.5s".
This should have a heading line, which is a single complete sentence.
> +(defvar seconds-to-string-readable
> + `(("Y" "year" "years" ,(round (* 60 60 24 365.2425)))
> + ("M" "month" "months" ,(round (* 60 60 24 30.436875)))
> + ("w" "week" "weeks" ,(* 60 60 24 7))
> + ("d" "day" "days" ,(* 60 60 24))
> + ("h" "hour" "hours" ,(* 60 60))
> + ("m" "minute" "minutes" 60)
> + ("s" "second" "seconds" 1))
> + "Formatting used by the function `seconds-to-string' with READABLE set.")
Please exp.lain in more detail the format of this list's elements, so
that people could modify it more easily in the future.
> +(defun seconds-to-string (delay &optional readable abbrev precision)
> + "Convert time interval DELAY (in seconds) to a short string.
^^^^^^^^^^^^
Why "short"?
> +By default, the returned string has two decimal precision in the
> +smallest unit that is larger than DELAY from the variable
> +`seconds-to-string'.
I couldn't parse this sentence. "Two decimal precision"? is that a
typo?
Thanks.
next prev parent reply other threads:[~2024-12-07 13:02 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-15 17:24 bug#71573: [PATCH] seconds-to-string-approximate JD Smith
2024-06-15 17:36 ` Eli Zaretskii
2024-06-17 6:20 ` bug#71573: Related functions from ts.el Adam Porter
2024-06-22 10:55 ` Stefan Kangas
2024-06-22 21:54 ` Adam Porter
2024-06-22 8:45 ` bug#71572: [PATCH] seconds-to-string-approximate Eli Zaretskii
2024-06-22 21:56 ` Adam Porter
2024-06-22 23:42 ` Paul Eggert
2024-06-23 2:16 ` JD Smith
2024-07-04 5:29 ` Eli Zaretskii
2024-07-04 6:04 ` Eli Zaretskii
2024-07-04 7:09 ` Paul Eggert
2024-07-06 19:29 ` JD Smith
2024-07-06 21:09 ` Paul Eggert
2024-07-11 21:01 ` JD Smith
2024-11-30 18:58 ` JD Smith
2024-12-07 13:02 ` Eli Zaretskii [this message]
2024-12-07 17:52 ` JD Smith
2024-12-07 19:17 ` john muhl
2024-12-08 19:52 ` JD Smith
2024-12-08 22:51 ` john muhl
2024-12-15 18:07 ` JD Smith
2024-12-15 23:26 ` john muhl
2024-07-04 15:27 ` JD Smith
2024-07-04 15:59 ` Eli Zaretskii
2024-07-04 17:16 ` JD Smith
2024-07-04 18:06 ` Eli Zaretskii
2024-07-04 16:36 ` Ihor Radchenko
2024-07-04 17:23 ` JD Smith
2024-07-04 17:57 ` Ihor Radchenko
2024-06-23 5:13 ` Eli Zaretskii
2024-07-03 20:32 ` JD Smith
2024-07-04 5:29 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86jzcbir3c.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=71572@debbugs.gnu.org \
--cc=adam@alphapapa.net \
--cc=eggert@cs.ucla.edu \
--cc=jdtsmith@gmail.com \
--cc=jonas@bernoul.li \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).