[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71572: [PATCH] seconds-to-string-approximate
From: |
john muhl |
Subject: |
bug#71572: [PATCH] seconds-to-string-approximate |
Date: |
Sun, 08 Dec 2024 16:51:51 -0600 |
User-agent: |
mu4e 1.12.1; emacs 31.0.50 |
JD Smith <jdtsmith@gmail.com> writes:
> On Dec 8, 2024, at 4:17 AM, john muhl <jm@pub.pink> wrote:
>
> JD Smith <jdtsmith@gmail.com> writes:
>
> On Dec 7, 2024, at 8:02 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> 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:
>
> Thanks. Updated patch below.
>
> 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"
>
> ...
>
> According to the Chicago Manual of Style all fractional values are
> plural, even 1.0, 2.0 &c.
>
> Thanks for this, a case I hadn't tested. Corrected in the attached.
Looks good but the bigger interval is still always singular in the
expanded w/ precision case:
(seconds-to-string 73082924 'expanded nil 2)
;; "2 year 3.79 months"
;; ^ should be years
I got it working with:
@@ -477,7 +477,7 @@ seconds-to-string
(concat
(when here-pre
(concat (number-to-string cnt-pre) padding
- (unit (* cnt-pre round-to) here-pre) " "))
+ (unit (* cnt-pre round-to) here-pre (> cnt-pre 1)) " "))
(if isfloatp (format dformat cnt-val)
(number-to-string (floor cnt-val)))
padding
Thanks again.