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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: JD Smith <jdtsmith@HIDDEN>; Keywords: patch; merged with #71573; dated Sat, 15 Jun 2024 17:25:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 23 Jun 2024 05:13:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 01:13:19 2024
Received: from localhost ([127.0.0.1]:44685 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLFXT-0005zI-JS
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2024 01:13:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:56050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sLFXQ-0005z5-M7
 for 71572 <at> debbugs.gnu.org; Sun, 23 Jun 2024 01:13:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sLFXD-0003qh-PW; Sun, 23 Jun 2024 01:13:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=PL0ZlvjfjAs4T9QoCjdJJudQaoLChEMWsw43xDZApsM=; b=H+ndxPSv9Z7G
 /dvUyF7ARIY9RtFYpR/61+rSDmn3IweBAmtclwoXvjIceXVsMQmFWvC8oRw+OmYFZgZG7GBjiYW8Q
 0eZFxk5Z9vc6AQS/E+Gte/utz7ByDJ8RMfx/pQ3WIdCpY/dFFvc+zQ9zR5ftxJ7nxmxJXaMS5hJTp
 XkM3hwXnDlb4cwJZjICUN3mMKAuuOK1+EXV/mQcokzPTM17Z5Syql+Kbmdw9bpyMaixJRQSKZ3PBh
 IbS66ra58dHjtz2uRbbeHQvWvjNwy3NJw8mrUtSqN3nNqXmUB7oIjPLlfaXntgb3QftTTycFLJNvv
 Ykw45XXJS7mF1EN9O4TNIg==;
Date: Sun, 23 Jun 2024 08:13:01 +0300
Message-Id: <86bk3sfdia.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN> (message from
 Paul Eggert on Sat, 22 Jun 2024 19:42:25 -0400)
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
 <86r0cpicwt.fsf@HIDDEN> <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71572
Cc: adam@HIDDEN, 71572 <at> debbugs.gnu.org, jonas@HIDDEN,
 jdtsmith@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 22 Jun 2024 19:42:25 -0400
> Cc: 71572 <at> debbugs.gnu.org, adam@HIDDEN, jonas@HIDDEN
> From: Paul Eggert <eggert@HIDDEN>
> 
> Isn't the master branch was in an long-term sort-of-frozen state, until 
> a branch is created for Emacs 30? If so I imagine changes in this area 
> should wait.

Yes, this is for Emacs 31.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 23 Jun 2024 02:18:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 22:18:04 2024
Received: from localhost ([127.0.0.1]:40058 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLCnr-0000PE-Jm
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 22:18:04 -0400
Received: from mail-qk1-f180.google.com ([209.85.222.180]:60629)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jdtsmith@HIDDEN>) id 1sLCnn-0000OT-Hh
 for 71572 <at> debbugs.gnu.org; Sat, 22 Jun 2024 22:18:01 -0400
Received: by mail-qk1-f180.google.com with SMTP id
 af79cd13be357-795ca45c54cso176664285a.0
 for <71572 <at> debbugs.gnu.org>; Sat, 22 Jun 2024 19:17:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719109013; x=1719713813; darn=debbugs.gnu.org;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=sMpff6FxhODlyq/XQcKye3CKdK66fJf9NuDiuN+5ko8=;
 b=TZnyuZAAJ4LeutEmK+qgoM6GzgeQS9jqOKUBLecJ/WJ9GxvHymq5DZPfnJpgOyQsI8
 WxqPDA5mqW3/fmfDDHpEkZyeqaf3nsuflix1fEzlZJ6F6HIsgEGKlwxxp0/15M4pBtjG
 H8DUxhQnZl1aBHqiMOpi6B7burCwU3z/spfOVRAa5J8x5sryOH2k1eot9CwkZrOVlWkn
 4WqwAZvkdnUSAFKpmk53GxP4E8lOm2OrWZrX3U4/kzGVodmpn8rsCQ6IVqsVm4TvEijd
 /iyEV2UeUEgG6jZEjTsdrxwWqRbkH3lN8w1yja8uEBXvh/oX9uXWn24hjqNnj2lFG9Hp
 b8BA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719109013; x=1719713813;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=sMpff6FxhODlyq/XQcKye3CKdK66fJf9NuDiuN+5ko8=;
 b=JyblCftNMIjCDyzoNQMtGqsfd/gcGB9axpgEkCrQU7IqmC01AF/AoFvPUQEkP7JvIq
 cMnCszG587oXmgP82R5TVFyfvWrbW38gxFW/lu8vDVTLc0uV9Dkz6zj5OqCLNXgEr0nk
 GYGQL0knNH3FY7f/jPuRw2WohgwxL7pcIpxFV4dGoBJyJoBTdm5krH7RxwUWvFAKWmCB
 I5P9bFV352QPvfq26al8tjULM86VTe3e1GN+sGRB3cbHlxV4z6MSAEJM/VOc/PEy5+Om
 96+vjSIu0Sgzudkgo8OzEdZYscEP1FVXIBCyqu1jm8BksZXutLz+yXUw7SBimzYqqiJc
 CTRw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVIqwr90oQKhEz5d42erVuzFh8X/RMOgGIxPJPk7lXIuLmQZqjYVVADKUvAxW9waiyK542HmYfzqRmCswtJilVZkPsPtvg=
X-Gm-Message-State: AOJu0YyQFBxao7GuPr7Qv1ZomN9Xd48zukmzKeRQxhkq7Z7wg2nCi6tS
 ETRqYtvW+OhhrqraqPiWOvSNV0NyM82yrNGjdWHMqT7d1MZ6hqrd
X-Google-Smtp-Source: AGHT+IHLZQk0/Ihoa5oW5sTU2a19cBtkl7H6to8tLX/UDNDTcIUUTPxmZ3W6WWmwjXV0hYVpOnRikA==
X-Received: by 2002:a05:6214:5581:b0:6b5:44c:24ea with SMTP id
 6a1803df08f44-6b5409c2d01mr12698206d6.16.1719109013446; 
 Sat, 22 Jun 2024 19:16:53 -0700 (PDT)
Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net.
 [24.53.187.34]) by smtp.gmail.com with ESMTPSA id
 6a1803df08f44-6b51ecfec5csm21659606d6.21.2024.06.22.19.16.51
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 22 Jun 2024 19:16:52 -0700 (PDT)
From: JD Smith <jdtsmith@HIDDEN>
Message-Id: <CE7E0586-64CF-42FA-9C9E-EB811623C68B@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
Date: Sat, 22 Jun 2024 22:16:40 -0400
In-Reply-To: <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
 <86r0cpicwt.fsf@HIDDEN> <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71572
Cc: Adam Porter <adam@HIDDEN>, 71572 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz@HIDDEN>, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Jun 22, 2024, at 7:42=E2=80=AFPM, Paul Eggert <eggert@HIDDEN> =
wrote:
>=20
> On 6/22/24 04:45, Eli Zaretskii wrote:
>>>=20
>> Paul, any comments to the patch?
>=20
> For starters:

Thanks for the comment.

> Why define a new function, instead of adding optional arguments to the =
existing one?

No real reason; new patch doing so attached.

> Why not look at what mastodon.el does, as the comment in =
seconds-to-string suggests? For example, mastodon-tl--human-duration =
lets you specify whatever resolution you want, instead of limiting you =
to either 0.5 or 1  as in the proposed patch.

I see that mastodon is a package in ELPA, so doesn't satisfy the need in =
core.  I took a look at this function.  The RESOLUTION mentioned is not =
equivalent to the HALF argument, it is the minimum resolution in =
seconds.  So setting it to e.g. 3600 results in truncating to the hour, =
but changes nothing below the hour.  Setting it to the number of seconds =
in a year gives something quite similar to magit--age (though I notice =
the mastodon function truncates, instead of rounds; see, e.g., 2.98y in =
the table below).

Here's a comparison among:

- the current seconds-to-string
- mastodon-tl--human-duration
- mastodon with a 3600s resolution
- mastodon with 1yr "resolution"
- the new seconds-to-string with option READABLE=3Dt
- new seconds-to-string with abbreviated units and half unit resolution

  Delay (s)      s-to-s            mastodon    mastodon (3600s)    mast =
(1yr)  s-to-s (rdb)  s-to-s (rdb=3Dabbrev, half)
        0.5    450.00ms               0 sec               0 sec         =
0 sec     0 seconds  =C2=BDs
        1.0       1.03s               1 sec               1 sec         =
1 sec      1 second  1s
        2.4       2.38s              2 secs              2 secs        2 =
secs     2 seconds  2=C2=BDs
        5.5       5.48s              5 secs              5 secs        5 =
secs     5 seconds  5=C2=BDs
       12.6      12.59s             12 secs             12 secs       12 =
secs    13 seconds  12=C2=BDs
       29.0      28.96s             28 secs             28 secs       28 =
secs    29 seconds  29s
       66.6      66.62s               1 min               1 min         =
1 min      1 minute  1m
      153.2       2.55m              2 mins              2 mins        2 =
mins     3 minutes  2=C2=BDm
      352.4       5.87m              5 mins              5 mins        5 =
mins     6 minutes  6m
      810.5      13.51m             13 mins             13 mins       13 =
mins    14 minutes  13=C2=BDm
     1864.2      31.07m             31 mins             31 mins       31 =
mins    31 minutes  31m
     4287.6      71.46m     1 hour, 11 mins              1 hour        1 =
hour        1 hour  1h
     9861.6       2.74h    2 hours, 44 mins             2 hours       2 =
hours       3 hours  2=C2=BDh
    22681.6       6.30h    6 hours, 18 mins             6 hours       6 =
hours       6 hours  6=C2=BDh
    52167.8      14.49h   14 hours, 29 mins            14 hours      14 =
hours      14 hours  14=C2=BDh
   119985.9       1.39d      1 day, 9 hours      1 day, 9 hours         =
1 day         1 day  1=C2=BDd
   275967.5       3.19d     3 days, 4 hours     3 days, 4 hours        3 =
days        3 days  3d
   634725.2       7.35d              1 week              1 week        1 =
week        1 week  1w
  1459867.9      16.90d     2 weeks, 2 days     2 weeks, 2 days       2 =
weeks       2 weeks  2=C2=BDw
  3357696.2      38.86d     1 month, 1 week     1 month, 1 week       1 =
month       1 month  1=C2=BDM
  7722701.2      89.38d   2 months, 4 weeks   2 months, 4 weeks      2 =
months      3 months  3M
 17762212.9     205.58d   6 months, 3 weeks   6 months, 3 weeks      6 =
months      7 months  7M
 40853089.6       1.29y    1 year, 3 months    1 year, 3 months        1 =
year        1 year  1=C2=BDY
 93962106.0       2.98y  2 years, 11 months  2 years, 11 months       2 =
years       3 years  3Y
216112843.8       6.85y  6 years, 10 months  6 years, 10 months       6 =
years       7 years  7Y
497059540.7      15.75y  15 years, 9 months  15 years, 9 months      15 =
years      16 years  16Y

The last column is obviously the most compact while still conveying a =
good amount of information, but the 1yr mastodon and normal READABLE =
s-to-s are also quite good (effectively equivalent to magit--age) for a =
quick glance and maintaining ~constant widths.  I do find it awkward to =
set the RESOLUTION argument to >30 million seconds to achieve this.  It =
took me a bit to understand what this argument does.=20

Code use to produce:

(concat
 (format "%11s  %10s  %18s  %18s  %12s  %12s  %s\n" "Delay (s)" "s-to-s"
         "mastodon" "mastodon (3600s)" "mast (1yr)" "s-to-s (rdb)" =
"s-to-s (rdb=3Dabbrev, half)")
 (cl-loop for s =3D 0.45 then (* s 2.3) while (< s (* 365.25 24 3600 =
22))
          concat (format "%11.1f  %10s  %18s  %18s  %12s  %12s  %s\n" s
                         (seconds-to-string s)
                         (car (mastodon-tl--human-duration s))
                         (car (mastodon-tl--human-duration s 3600))
                         (car (mastodon-tl--human-duration s (* 365.25 =
24 3600)))
                         (seconds-to-string s t)
                         (seconds-to-string s 'abbrev 'half))))

=EF=BF=BC=

--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88"


--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;"><br =
id=3D"lineBreakAtBeginningOfMessage"><div><br><blockquote =
type=3D"cite"><div>On Jun 22, 2024, at 7:42=E2=80=AFPM, Paul Eggert =
&lt;eggert@HIDDEN&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><div>On 6/22/24 04:45, Eli =
Zaretskii wrote:<br><blockquote type=3D"cite"><blockquote =
type=3D"cite"><br></blockquote>Paul, any comments to the =
patch?<br></blockquote><br>For =
starters:<br></div></div></blockquote><div><br></div>Thanks for the =
comment.</div><div><br><blockquote type=3D"cite"><div><div>Why define a =
new function, instead of adding optional arguments to the existing =
one?<br></div></div></blockquote><div><br></div><div>No real reason; new =
patch doing so attached.</div><br><blockquote type=3D"cite"><div><div>Why =
not look at what mastodon.el does, as the comment in seconds-to-string =
suggests? For example, mastodon-tl--human-duration lets you specify =
whatever resolution you want, instead of limiting you to either 0.5 or 1 =
&nbsp;as in the proposed =
patch.<br></div></div></blockquote><div><br></div><div>I see that =
mastodon is a package in ELPA, so doesn't satisfy the need in core. =
&nbsp;I took a look at this function. &nbsp;The RESOLUTION mentioned is =
not equivalent to the HALF argument, it is the minimum resolution in =
seconds. &nbsp;So setting it to e.g. 3600 results in truncating to the =
hour, but changes nothing below the hour. &nbsp;Setting it to the number =
of seconds in a year gives something quite similar to magit--age (though =
I notice the mastodon function truncates, instead of rounds; see, e.g., =
2.98y in the table below).</div><div><br></div><div>Here's a comparison =
among:</div><div><br></div><div>- the current =
seconds-to-string</div><div>- mastodon-tl--human-duration</div><div>- =
mastodon with a 3600s resolution</div><div>- mastodon with 1yr =
"resolution"</div><div>- the new seconds-to-string with option =
READABLE=3Dt</div><div>- new seconds-to-string with abbreviated units =
and half unit resolution</div><div><br></div><div><div><div>&nbsp;<font =
face=3D"Andale Mono">&nbsp;Delay (s) &nbsp; &nbsp; &nbsp;s-to-s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mastodon &nbsp; &nbsp;mastodon (3600s) =
&nbsp; &nbsp;mast (1yr) &nbsp;s-to-s (rdb) &nbsp;s-to-s (rdb=3Dabbrev, =
half)</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; 0.5 &nbsp; &nbsp;450.00ms &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; 0 sec &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 =
sec &nbsp; &nbsp; &nbsp; &nbsp; 0 sec &nbsp; &nbsp; 0 seconds =
&nbsp;=C2=BDs</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
&nbsp; &nbsp; 1.0 &nbsp; &nbsp; &nbsp; 1.03s &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; 1 sec &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; 1 sec &nbsp; &nbsp; &nbsp; &nbsp; 1 sec &nbsp; &nbsp; &nbsp;1 =
second &nbsp;1s</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp; &nbsp; &nbsp; 2.4 &nbsp; &nbsp; &nbsp; 2.38s &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;2 secs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;2 secs &nbsp; &nbsp; &nbsp; &nbsp;2 secs &nbsp; &nbsp; 2 =
seconds &nbsp;2=C2=BDs</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; 5.5 &nbsp; &nbsp; &nbsp; 5.48s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 secs &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;5 secs &nbsp; &nbsp; &nbsp; &nbsp;5 secs =
&nbsp; &nbsp; 5 seconds &nbsp;5=C2=BDs</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp;12.6 &nbsp; &nbsp; =
&nbsp;12.59s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12 secs &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12 secs &nbsp; &nbsp; &nbsp; 12 secs =
&nbsp; &nbsp;13 seconds &nbsp;12=C2=BDs</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp;29.0 &nbsp; &nbsp; =
&nbsp;28.96s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28 secs &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28 secs &nbsp; &nbsp; &nbsp; 28 secs =
&nbsp; &nbsp;29 seconds &nbsp;29s</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp;66.6 &nbsp; &nbsp; &nbsp;66.62s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 min &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; 1 min &nbsp; &nbsp; &nbsp; &nbsp; 1 min =
&nbsp; &nbsp; &nbsp;1 minute &nbsp;1m</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 153.2 &nbsp; &nbsp; &nbsp; =
2.55m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 mins &nbsp; &nbsp; &nbsp; =
&nbsp;2 mins &nbsp; &nbsp; 3 minutes &nbsp;2=C2=BDm</font></div><div><font=
 face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 352.4 &nbsp; &nbsp; &nbsp; =
5.87m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 mins &nbsp; &nbsp; &nbsp; =
&nbsp;5 mins &nbsp; &nbsp; 6 minutes &nbsp;6m</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 810.5 &nbsp; &nbsp; =
&nbsp;13.51m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13 mins &nbsp; &nbsp; &nbsp; 13 mins =
&nbsp; &nbsp;14 minutes &nbsp;13=C2=BDm</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp;1864.2 &nbsp; &nbsp; =
&nbsp;31.07m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 31 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 31 mins &nbsp; &nbsp; &nbsp; 31 mins =
&nbsp; &nbsp;31 minutes &nbsp;31m</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp;4287.6 &nbsp; &nbsp; &nbsp;71.46m &nbsp; =
&nbsp; 1 hour, 11 mins &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 =
hour &nbsp; &nbsp; &nbsp; &nbsp;1 hour &nbsp; &nbsp; &nbsp; &nbsp;1 hour =
&nbsp;1h</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
&nbsp;9861.6 &nbsp; &nbsp; &nbsp; 2.74h &nbsp; &nbsp;2 hours, 44 mins =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 hours &nbsp; &nbsp; &nbsp; 2 =
hours &nbsp; &nbsp; &nbsp; 3 hours &nbsp;2=C2=BDh</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; 22681.6 &nbsp; &nbsp; &nbsp; 6.30h =
&nbsp; &nbsp;6 hours, 18 mins &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
6 hours &nbsp; &nbsp; &nbsp; 6 hours &nbsp; &nbsp; &nbsp; 6 hours =
&nbsp;6=C2=BDh</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
52167.8 &nbsp; &nbsp; &nbsp;14.49h &nbsp; 14 hours, 29 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;14 hours &nbsp; &nbsp; &nbsp;14 hours =
&nbsp; &nbsp; &nbsp;14 hours &nbsp;14=C2=BDh</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp;119985.9 &nbsp; &nbsp; &nbsp; 1.39d =
&nbsp; &nbsp; &nbsp;1 day, 9 hours &nbsp; &nbsp; &nbsp;1 day, 9 hours =
&nbsp; &nbsp; &nbsp; &nbsp; 1 day &nbsp; &nbsp; &nbsp; &nbsp; 1 day =
&nbsp;1=C2=BDd</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp;275967.5 &nbsp; &nbsp; &nbsp; 3.19d &nbsp; &nbsp; 3 days, 4 hours =
&nbsp; &nbsp; 3 days, 4 hours &nbsp; &nbsp; &nbsp; &nbsp;3 days &nbsp; =
&nbsp; &nbsp; &nbsp;3 days &nbsp;3d</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp;634725.2 &nbsp; &nbsp; &nbsp; 7.35d &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 week &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp;1 week &nbsp; &nbsp; &nbsp; &nbsp;1 week &nbsp; =
&nbsp; &nbsp; &nbsp;1 week &nbsp;1w</font></div><div><font face=3D"Andale =
Mono">&nbsp; 1459867.9 &nbsp; &nbsp; &nbsp;16.90d &nbsp; &nbsp; 2 weeks, =
2 days &nbsp; &nbsp; 2 weeks, 2 days &nbsp; &nbsp; &nbsp; 2 weeks &nbsp; =
&nbsp; &nbsp; 2 weeks &nbsp;2=C2=BDw</font></div><div><font face=3D"Andale=
 Mono">&nbsp; 3357696.2 &nbsp; &nbsp; &nbsp;38.86d &nbsp; &nbsp; 1 =
month, 1 week &nbsp; &nbsp; 1 month, 1 week &nbsp; &nbsp; &nbsp; 1 month =
&nbsp; &nbsp; &nbsp; 1 month &nbsp;1=C2=BDM</font></div><div><font =
face=3D"Andale Mono">&nbsp; 7722701.2 &nbsp; &nbsp; &nbsp;89.38d &nbsp; =
2 months, 4 weeks &nbsp; 2 months, 4 weeks &nbsp; &nbsp; &nbsp;2 months =
&nbsp; &nbsp; &nbsp;3 months &nbsp;3M</font></div><div><font =
face=3D"Andale Mono">&nbsp;17762212.9 &nbsp; &nbsp; 205.58d &nbsp; 6 =
months, 3 weeks &nbsp; 6 months, 3 weeks &nbsp; &nbsp; &nbsp;6 months =
&nbsp; &nbsp; &nbsp;7 months &nbsp;7M</font></div><div><font =
face=3D"Andale Mono">&nbsp;40853089.6 &nbsp; &nbsp; &nbsp; 1.29y &nbsp; =
&nbsp;1 year, 3 months &nbsp; &nbsp;1 year, 3 months &nbsp; &nbsp; =
&nbsp; &nbsp;1 year &nbsp; &nbsp; &nbsp; &nbsp;1 year =
&nbsp;1=C2=BDY</font></div><div><font face=3D"Andale =
Mono">&nbsp;93962106.0 &nbsp; &nbsp; &nbsp; 2.98y &nbsp;2 years, 11 =
months &nbsp;2 years, 11 months &nbsp; &nbsp; &nbsp; 2 years &nbsp; =
&nbsp; &nbsp; 3 years &nbsp;3Y</font></div><div><font face=3D"Andale =
Mono">216112843.8 &nbsp; &nbsp; &nbsp; 6.85y &nbsp;6 years, 10 months =
&nbsp;6 years, 10 months &nbsp; &nbsp; &nbsp; 6 years &nbsp; &nbsp; =
&nbsp; 7 years &nbsp;7Y</font></div><div><font face=3D"Andale =
Mono">497059540.7 &nbsp; &nbsp; &nbsp;15.75y &nbsp;15 years, 9 months =
&nbsp;15 years, 9 months &nbsp; &nbsp; &nbsp;15 years &nbsp; &nbsp; =
&nbsp;16 years &nbsp;16Y</font></div><div><br></div></div><div><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">The last =
column is obviously the most compact while still conveying a good amount =
of information, but the 1yr mastodon and normal READABLE s-to-s are also =
quite good (effectively equivalent to magit--age) for a quick glance and =
maintaining ~constant widths. &nbsp;I do find it awkward to set =
the&nbsp;</span><span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, =
0, 0);">RESOLUTION argument to&nbsp;</span><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);">&gt;30 million seconds to achieve =
this. &nbsp;It took me a bit to understand what this argument =
does.&nbsp;</span></div><div><br></div><div>Code use to =
produce:</div></div><div><br></div><div><div><font face=3D"Andale =
Mono">(concat</font></div><div><font face=3D"Andale Mono">&nbsp;(format =
"%11s &nbsp;%10s &nbsp;%18s &nbsp;%18s &nbsp;%12s &nbsp;%12s &nbsp;%s\n" =
"Delay (s)" "s-to-s"</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;"mastodon" "mastodon (3600s)" "mast (1yr)" =
"s-to-s (rdb)" "s-to-s (rdb=3Dabbrev, half)")</font></div><div><font =
face=3D"Andale Mono">&nbsp;(cl-loop for s =3D 0.45 then (* s 2.3) while =
(&lt; s (* 365.25 24 3600 22))</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; concat (format "%11.1f =
&nbsp;%10s &nbsp;%18s &nbsp;%18s &nbsp;%12s &nbsp;%12s &nbsp;%s\n" =
s</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(seconds-to-string s)</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;(car (mastodon-tl--human-duration =
s))</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(car (mastodon-tl--human-duration s 3600))</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(car =
(mastodon-tl--human-duration s (* 365.25 24 =
3600)))</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(seconds-to-string s t)</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;(seconds-to-string s 'abbrev =
'half))))</font></div></div><div><br></div></div></body></html>=

--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Disposition: attachment;
	filename=time-data-readable-seconds.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="time-data-readable-seconds.patch"
Content-Transfer-Encoding: quoted-printable

---=20time-date.el=092024-06-22=2021:51:21=0A+++=20time-date_new.el=09=
2024-06-22=2021:53:13=0A@@=20-406,10=20+406,41=20@@=0A=20=20=20=20=20=20=20=
=20=20(list=20(*=203600=2024=20400)=20"d"=20(*=203600.0=2024.0))=0A=20=20=
=20=20=20=20=20=20=20(list=20nil=20"y"=20(*=20365.25=2024=203600)))=0A=20=
=20=20"Formatting=20used=20by=20the=20function=20`seconds-to-string'.")=0A=
+=0A+(defvar=20seconds-to-string-readable=0A+=20=20`(("Y"=20"year"=20=20=20=
"years"=20=20=20,(round=20(*=2060=2060=2024=20365.2425)))=0A+=20=20=20=20=
("M"=20"month"=20=20"months"=20=20,(round=20(*=2060=2060=2024=20=
30.436875)))=0A+=20=20=20=20("w"=20"week"=20=20=20"weeks"=20=20=20,(*=20=
60=2060=2024=207))=0A+=20=20=20=20("d"=20"day"=20=20=20=20"days"=20=20=20=
=20,(*=2060=2060=2024))=0A+=20=20=20=20("h"=20"hour"=20=20=20"hours"=20=20=
=20,(*=2060=2060))=0A+=20=20=20=20("m"=20"minute"=20"minutes"=2060)=0A+=20=
=20=20=20("s"=20"second"=20"seconds"=201))=0A+=20=20"Formatting=20used=20=
by=20the=20function=20`seconds-to-string'=20with=20READABLE=20set.")=0A+=0A=
=20;;;###autoload=0A-(defun=20seconds-to-string=20(delay)=0A-=20=20=
"Convert=20the=20time=20interval=20in=20seconds=20to=20a=20short=20=
string."=0A-=20=20(cond=20((>=200=20delay)=20(concat=20"-"=20=
(seconds-to-string=20(-=20delay))))=0A+(defun=20seconds-to-string=20=
(delay=20&optional=20readable=20half)=0A+=20=20"Convert=20the=20time=20=
interval=20in=20seconds=20to=20a=20short=20string.=0A+If=20READABLE=20is=20=
non-nil,=20convert=20DELAY=20into=20a=20readable=20string.=20=20If=20it=20=
is=0A+the=20value=20`abbrev',=20abbreviate=20the=20units.=20=20If=20HALF=20=
is=20set,=20round=20to=20the=0A+nearest=20half=20unit."=0A+=20=20(cond=20=
((>=200=20delay)=20(concat=20"-"=20(seconds-to-string=20(-=20delay)=20=
readable=20half)))=0A+=20=20=20=20=20=20=20=20(readable=0A+=20=20=20=20=20=
=20=20=20=20(let=20((abbrev=20(eq=20readable=20'abbrev))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(stsa=20seconds-to-string-readable)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20here=20cnt)=0A+=20=20=20=20=20=20=20=
=20=20=20=20(if=20(=3D=20(round=20delay=20(if=20half=200.5=201.))=200)=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(format=20"0%s"=20(if=20=
abbrev=20"s"=20"=20seconds"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
(while=20(and=20(setq=20here=20(pop=20stsa))=20stsa=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(<=20(/=20delay=20=
(nth=203=20here))=201)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20=
cnt=20(round=20(/=20(float=20delay)=20(nth=203=20here))=20(if=20half=20=
0.5=201.)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(concat=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(let=20((c=20(if=20half=20(/=20cnt=202)=20=
cnt)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(>=20c=20=
0)=20(number-to-string=20c)=20""))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(if=20(and=20half=20(=3D=20(mod=20cnt=202)=201))=20"=C2=BD"=20"")=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20abbrev=20""=20"=20")=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cond=20(abbrev=20(car=20=
here))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
((<=3D=20cnt=20(if=20half=202=201))=20(nth=201=20here))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20(nth=202=20here)))))))=0A=
=20=20=20=20=20=20=20=20=20((=3D=200=20delay)=20"0s")=0A=20=20=20=20=20=20=
=20=20=20(t=20(let=20((sts=20seconds-to-string)=20here)=0A=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(while=20(and=20(car=20(setq=20here=20(pop=20=
sts)))=0A=

--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div></div></body></html>
--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88--

--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 23 Jun 2024 02:18:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 22:18:03 2024
Received: from localhost ([127.0.0.1]:40056 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLCnq-0000Oy-BP
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 22:18:03 -0400
Received: from mail-io1-f45.google.com ([209.85.166.45]:60653)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jdtsmith@HIDDEN>) id 1sLCnn-0000OV-Rx
 for 71572 <at> debbugs.gnu.org; Sat, 22 Jun 2024 22:18:00 -0400
Received: by mail-io1-f45.google.com with SMTP id
 ca18e2360f4ac-7f39d30e362so37716239f.0
 for <71572 <at> debbugs.gnu.org>; Sat, 22 Jun 2024 19:17:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1719109014; x=1719713814; darn=debbugs.gnu.org;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=sMpff6FxhODlyq/XQcKye3CKdK66fJf9NuDiuN+5ko8=;
 b=gJdZ/Zfzd9IlIcKeEiGTbL+YgjpM7qZCzxuLEvOEok/mFmR0Pb2ejUWDsMJWHhPWVC
 s5+t0s7Y6zyBTHg0BPtZJpraxpT9vnDdE64AeYhxCe9ARaB3WsDoXoZPygfwmiVoc1s8
 qfTY2w6px/53ZfV2c1ThnqjibQhpX9O4LfTHWAggHM1FMHmiVviM5Lvv2SVrNQGffoK6
 3gh004O4lWJ+7yyN6JN6TJc5OYuss0KmqIiNfFxqOJxOCKUJbKOIMZ1FeL5RLCOiXKqE
 DwPJN3STQ6fooxvxFRg6BwQ6D2N3vzb5ubw3g/Tm4hzCcBft29qjAGH94EYjXGqnmiRN
 ns2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719109014; x=1719713814;
 h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=sMpff6FxhODlyq/XQcKye3CKdK66fJf9NuDiuN+5ko8=;
 b=j3RaiK5JIjnzy44httLn/AWPSHCT6GGoB/l0hMMYD/wt8kNwG4qcCwN6ghZ0gxl1wp
 GQc9t7jUWUCfbMibJW16rygQOKXg5tZ/yBtkWksxchXj2yNlGAGMCn1crGymLBO7nPIt
 ZZYDdYCKlMBzlB72lAkSYWtvirb1NAipF2JsNRvfYjFH4tQcwC3S8EBD64AiiXN+zH2I
 lURWHd1veNb3lW4MukAwTAKF79EUemtz7yHLRySV53vVv5d10aA3xSvZ+fX/GJvOzo1Q
 qD84KvcvMAM7Ym5xZmMVUqN/b0A3w993M3NQ9u/R80+8ScP0JrQXuDv/aaIZKDOOOMmz
 ogrw==
X-Forwarded-Encrypted: i=1;
 AJvYcCXc8rRL8oLRlHyNu3jvgcY4Tk90/DNs21/F4R9KCrAoUNL97TQaKDs9KARXILXvAU5hiOyc/JRQexo8LTGIMixR5xkssjU=
X-Gm-Message-State: AOJu0Yy0xnlA4lk2JIg6AzBrNTdHrAEVZ3vQE20SN8tQkFtb+Onc190U
 cCLNp/J6HGzAuySMhhjbIPYau2TZYOGfOKTiEom7b0LUpxW3kJug
X-Google-Smtp-Source: AGHT+IESTA6dXdayKrVRIx12lH/h+08NmjD2TaqtTY8oiRfJ7/NL4ku60a63/LvPIoX43QAVG+mF2A==
X-Received: by 2002:a05:6602:6c04:b0:7eb:81d6:c914 with SMTP id
 ca18e2360f4ac-7f3a7471000mr146381739f.4.1719109013751; 
 Sat, 22 Jun 2024 19:16:53 -0700 (PDT)
Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net.
 [24.53.187.34]) by smtp.gmail.com with ESMTPSA id
 8926c6da1cb9f-4b9d113f653sm1208704173.77.2024.06.22.19.16.52
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 22 Jun 2024 19:16:53 -0700 (PDT)
From: JD Smith <jdtsmith@HIDDEN>
Message-Id: <CE7E0586-64CF-42FA-9C9E-EB811623C68B@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
Date: Sat, 22 Jun 2024 22:16:40 -0400
In-Reply-To: <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
 <86r0cpicwt.fsf@HIDDEN> <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 71572
Cc: Adam Porter <adam@HIDDEN>, 71572 <at> debbugs.gnu.org,
 Eli Zaretskii <eliz@HIDDEN>, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Jun 22, 2024, at 7:42=E2=80=AFPM, Paul Eggert <eggert@HIDDEN> =
wrote:
>=20
> On 6/22/24 04:45, Eli Zaretskii wrote:
>>>=20
>> Paul, any comments to the patch?
>=20
> For starters:

Thanks for the comment.

> Why define a new function, instead of adding optional arguments to the =
existing one?

No real reason; new patch doing so attached.

> Why not look at what mastodon.el does, as the comment in =
seconds-to-string suggests? For example, mastodon-tl--human-duration =
lets you specify whatever resolution you want, instead of limiting you =
to either 0.5 or 1  as in the proposed patch.

I see that mastodon is a package in ELPA, so doesn't satisfy the need in =
core.  I took a look at this function.  The RESOLUTION mentioned is not =
equivalent to the HALF argument, it is the minimum resolution in =
seconds.  So setting it to e.g. 3600 results in truncating to the hour, =
but changes nothing below the hour.  Setting it to the number of seconds =
in a year gives something quite similar to magit--age (though I notice =
the mastodon function truncates, instead of rounds; see, e.g., 2.98y in =
the table below).

Here's a comparison among:

- the current seconds-to-string
- mastodon-tl--human-duration
- mastodon with a 3600s resolution
- mastodon with 1yr "resolution"
- the new seconds-to-string with option READABLE=3Dt
- new seconds-to-string with abbreviated units and half unit resolution

  Delay (s)      s-to-s            mastodon    mastodon (3600s)    mast =
(1yr)  s-to-s (rdb)  s-to-s (rdb=3Dabbrev, half)
        0.5    450.00ms               0 sec               0 sec         =
0 sec     0 seconds  =C2=BDs
        1.0       1.03s               1 sec               1 sec         =
1 sec      1 second  1s
        2.4       2.38s              2 secs              2 secs        2 =
secs     2 seconds  2=C2=BDs
        5.5       5.48s              5 secs              5 secs        5 =
secs     5 seconds  5=C2=BDs
       12.6      12.59s             12 secs             12 secs       12 =
secs    13 seconds  12=C2=BDs
       29.0      28.96s             28 secs             28 secs       28 =
secs    29 seconds  29s
       66.6      66.62s               1 min               1 min         =
1 min      1 minute  1m
      153.2       2.55m              2 mins              2 mins        2 =
mins     3 minutes  2=C2=BDm
      352.4       5.87m              5 mins              5 mins        5 =
mins     6 minutes  6m
      810.5      13.51m             13 mins             13 mins       13 =
mins    14 minutes  13=C2=BDm
     1864.2      31.07m             31 mins             31 mins       31 =
mins    31 minutes  31m
     4287.6      71.46m     1 hour, 11 mins              1 hour        1 =
hour        1 hour  1h
     9861.6       2.74h    2 hours, 44 mins             2 hours       2 =
hours       3 hours  2=C2=BDh
    22681.6       6.30h    6 hours, 18 mins             6 hours       6 =
hours       6 hours  6=C2=BDh
    52167.8      14.49h   14 hours, 29 mins            14 hours      14 =
hours      14 hours  14=C2=BDh
   119985.9       1.39d      1 day, 9 hours      1 day, 9 hours         =
1 day         1 day  1=C2=BDd
   275967.5       3.19d     3 days, 4 hours     3 days, 4 hours        3 =
days        3 days  3d
   634725.2       7.35d              1 week              1 week        1 =
week        1 week  1w
  1459867.9      16.90d     2 weeks, 2 days     2 weeks, 2 days       2 =
weeks       2 weeks  2=C2=BDw
  3357696.2      38.86d     1 month, 1 week     1 month, 1 week       1 =
month       1 month  1=C2=BDM
  7722701.2      89.38d   2 months, 4 weeks   2 months, 4 weeks      2 =
months      3 months  3M
 17762212.9     205.58d   6 months, 3 weeks   6 months, 3 weeks      6 =
months      7 months  7M
 40853089.6       1.29y    1 year, 3 months    1 year, 3 months        1 =
year        1 year  1=C2=BDY
 93962106.0       2.98y  2 years, 11 months  2 years, 11 months       2 =
years       3 years  3Y
216112843.8       6.85y  6 years, 10 months  6 years, 10 months       6 =
years       7 years  7Y
497059540.7      15.75y  15 years, 9 months  15 years, 9 months      15 =
years      16 years  16Y

The last column is obviously the most compact while still conveying a =
good amount of information, but the 1yr mastodon and normal READABLE =
s-to-s are also quite good (effectively equivalent to magit--age) for a =
quick glance and maintaining ~constant widths.  I do find it awkward to =
set the RESOLUTION argument to >30 million seconds to achieve this.  It =
took me a bit to understand what this argument does.=20

Code use to produce:

(concat
 (format "%11s  %10s  %18s  %18s  %12s  %12s  %s\n" "Delay (s)" "s-to-s"
         "mastodon" "mastodon (3600s)" "mast (1yr)" "s-to-s (rdb)" =
"s-to-s (rdb=3Dabbrev, half)")
 (cl-loop for s =3D 0.45 then (* s 2.3) while (< s (* 365.25 24 3600 =
22))
          concat (format "%11.1f  %10s  %18s  %18s  %12s  %12s  %s\n" s
                         (seconds-to-string s)
                         (car (mastodon-tl--human-duration s))
                         (car (mastodon-tl--human-duration s 3600))
                         (car (mastodon-tl--human-duration s (* 365.25 =
24 3600)))
                         (seconds-to-string s t)
                         (seconds-to-string s 'abbrev 'half))))

=EF=BF=BC=

--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88"


--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;"><br =
id=3D"lineBreakAtBeginningOfMessage"><div><br><blockquote =
type=3D"cite"><div>On Jun 22, 2024, at 7:42=E2=80=AFPM, Paul Eggert =
&lt;eggert@HIDDEN&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><div>On 6/22/24 04:45, Eli =
Zaretskii wrote:<br><blockquote type=3D"cite"><blockquote =
type=3D"cite"><br></blockquote>Paul, any comments to the =
patch?<br></blockquote><br>For =
starters:<br></div></div></blockquote><div><br></div>Thanks for the =
comment.</div><div><br><blockquote type=3D"cite"><div><div>Why define a =
new function, instead of adding optional arguments to the existing =
one?<br></div></div></blockquote><div><br></div><div>No real reason; new =
patch doing so attached.</div><br><blockquote type=3D"cite"><div><div>Why =
not look at what mastodon.el does, as the comment in seconds-to-string =
suggests? For example, mastodon-tl--human-duration lets you specify =
whatever resolution you want, instead of limiting you to either 0.5 or 1 =
&nbsp;as in the proposed =
patch.<br></div></div></blockquote><div><br></div><div>I see that =
mastodon is a package in ELPA, so doesn't satisfy the need in core. =
&nbsp;I took a look at this function. &nbsp;The RESOLUTION mentioned is =
not equivalent to the HALF argument, it is the minimum resolution in =
seconds. &nbsp;So setting it to e.g. 3600 results in truncating to the =
hour, but changes nothing below the hour. &nbsp;Setting it to the number =
of seconds in a year gives something quite similar to magit--age (though =
I notice the mastodon function truncates, instead of rounds; see, e.g., =
2.98y in the table below).</div><div><br></div><div>Here's a comparison =
among:</div><div><br></div><div>- the current =
seconds-to-string</div><div>- mastodon-tl--human-duration</div><div>- =
mastodon with a 3600s resolution</div><div>- mastodon with 1yr =
"resolution"</div><div>- the new seconds-to-string with option =
READABLE=3Dt</div><div>- new seconds-to-string with abbreviated units =
and half unit resolution</div><div><br></div><div><div><div>&nbsp;<font =
face=3D"Andale Mono">&nbsp;Delay (s) &nbsp; &nbsp; &nbsp;s-to-s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mastodon &nbsp; &nbsp;mastodon (3600s) =
&nbsp; &nbsp;mast (1yr) &nbsp;s-to-s (rdb) &nbsp;s-to-s (rdb=3Dabbrev, =
half)</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; 0.5 &nbsp; &nbsp;450.00ms &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; 0 sec &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 =
sec &nbsp; &nbsp; &nbsp; &nbsp; 0 sec &nbsp; &nbsp; 0 seconds =
&nbsp;=C2=BDs</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
&nbsp; &nbsp; 1.0 &nbsp; &nbsp; &nbsp; 1.03s &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; 1 sec &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; 1 sec &nbsp; &nbsp; &nbsp; &nbsp; 1 sec &nbsp; &nbsp; &nbsp;1 =
second &nbsp;1s</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp; &nbsp; &nbsp; 2.4 &nbsp; &nbsp; &nbsp; 2.38s &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;2 secs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;2 secs &nbsp; &nbsp; &nbsp; &nbsp;2 secs &nbsp; &nbsp; 2 =
seconds &nbsp;2=C2=BDs</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; 5.5 &nbsp; &nbsp; &nbsp; 5.48s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 secs &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;5 secs &nbsp; &nbsp; &nbsp; &nbsp;5 secs =
&nbsp; &nbsp; 5 seconds &nbsp;5=C2=BDs</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp;12.6 &nbsp; &nbsp; =
&nbsp;12.59s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12 secs &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12 secs &nbsp; &nbsp; &nbsp; 12 secs =
&nbsp; &nbsp;13 seconds &nbsp;12=C2=BDs</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp;29.0 &nbsp; &nbsp; =
&nbsp;28.96s &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28 secs &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 28 secs &nbsp; &nbsp; &nbsp; 28 secs =
&nbsp; &nbsp;29 seconds &nbsp;29s</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp;66.6 &nbsp; &nbsp; &nbsp;66.62s &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 min &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; 1 min &nbsp; &nbsp; &nbsp; &nbsp; 1 min =
&nbsp; &nbsp; &nbsp;1 minute &nbsp;1m</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 153.2 &nbsp; &nbsp; &nbsp; =
2.55m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 mins &nbsp; &nbsp; &nbsp; =
&nbsp;2 mins &nbsp; &nbsp; 3 minutes &nbsp;2=C2=BDm</font></div><div><font=
 face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 352.4 &nbsp; &nbsp; &nbsp; =
5.87m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5 mins &nbsp; &nbsp; &nbsp; =
&nbsp;5 mins &nbsp; &nbsp; 6 minutes &nbsp;6m</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; 810.5 &nbsp; &nbsp; =
&nbsp;13.51m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 13 mins &nbsp; &nbsp; &nbsp; 13 mins =
&nbsp; &nbsp;14 minutes &nbsp;13=C2=BDm</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp;1864.2 &nbsp; &nbsp; =
&nbsp;31.07m &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 31 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 31 mins &nbsp; &nbsp; &nbsp; 31 mins =
&nbsp; &nbsp;31 minutes &nbsp;31m</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp;4287.6 &nbsp; &nbsp; &nbsp;71.46m &nbsp; =
&nbsp; 1 hour, 11 mins &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 =
hour &nbsp; &nbsp; &nbsp; &nbsp;1 hour &nbsp; &nbsp; &nbsp; &nbsp;1 hour =
&nbsp;1h</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
&nbsp;9861.6 &nbsp; &nbsp; &nbsp; 2.74h &nbsp; &nbsp;2 hours, 44 mins =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2 hours &nbsp; &nbsp; &nbsp; 2 =
hours &nbsp; &nbsp; &nbsp; 3 hours &nbsp;2=C2=BDh</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; 22681.6 &nbsp; &nbsp; &nbsp; 6.30h =
&nbsp; &nbsp;6 hours, 18 mins &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
6 hours &nbsp; &nbsp; &nbsp; 6 hours &nbsp; &nbsp; &nbsp; 6 hours =
&nbsp;6=C2=BDh</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; =
52167.8 &nbsp; &nbsp; &nbsp;14.49h &nbsp; 14 hours, 29 mins &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;14 hours &nbsp; &nbsp; &nbsp;14 hours =
&nbsp; &nbsp; &nbsp;14 hours &nbsp;14=C2=BDh</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp;119985.9 &nbsp; &nbsp; &nbsp; 1.39d =
&nbsp; &nbsp; &nbsp;1 day, 9 hours &nbsp; &nbsp; &nbsp;1 day, 9 hours =
&nbsp; &nbsp; &nbsp; &nbsp; 1 day &nbsp; &nbsp; &nbsp; &nbsp; 1 day =
&nbsp;1=C2=BDd</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp;275967.5 &nbsp; &nbsp; &nbsp; 3.19d &nbsp; &nbsp; 3 days, 4 hours =
&nbsp; &nbsp; 3 days, 4 hours &nbsp; &nbsp; &nbsp; &nbsp;3 days &nbsp; =
&nbsp; &nbsp; &nbsp;3 days &nbsp;3d</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp;634725.2 &nbsp; &nbsp; &nbsp; 7.35d &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 week &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp;1 week &nbsp; &nbsp; &nbsp; &nbsp;1 week &nbsp; =
&nbsp; &nbsp; &nbsp;1 week &nbsp;1w</font></div><div><font face=3D"Andale =
Mono">&nbsp; 1459867.9 &nbsp; &nbsp; &nbsp;16.90d &nbsp; &nbsp; 2 weeks, =
2 days &nbsp; &nbsp; 2 weeks, 2 days &nbsp; &nbsp; &nbsp; 2 weeks &nbsp; =
&nbsp; &nbsp; 2 weeks &nbsp;2=C2=BDw</font></div><div><font face=3D"Andale=
 Mono">&nbsp; 3357696.2 &nbsp; &nbsp; &nbsp;38.86d &nbsp; &nbsp; 1 =
month, 1 week &nbsp; &nbsp; 1 month, 1 week &nbsp; &nbsp; &nbsp; 1 month =
&nbsp; &nbsp; &nbsp; 1 month &nbsp;1=C2=BDM</font></div><div><font =
face=3D"Andale Mono">&nbsp; 7722701.2 &nbsp; &nbsp; &nbsp;89.38d &nbsp; =
2 months, 4 weeks &nbsp; 2 months, 4 weeks &nbsp; &nbsp; &nbsp;2 months =
&nbsp; &nbsp; &nbsp;3 months &nbsp;3M</font></div><div><font =
face=3D"Andale Mono">&nbsp;17762212.9 &nbsp; &nbsp; 205.58d &nbsp; 6 =
months, 3 weeks &nbsp; 6 months, 3 weeks &nbsp; &nbsp; &nbsp;6 months =
&nbsp; &nbsp; &nbsp;7 months &nbsp;7M</font></div><div><font =
face=3D"Andale Mono">&nbsp;40853089.6 &nbsp; &nbsp; &nbsp; 1.29y &nbsp; =
&nbsp;1 year, 3 months &nbsp; &nbsp;1 year, 3 months &nbsp; &nbsp; =
&nbsp; &nbsp;1 year &nbsp; &nbsp; &nbsp; &nbsp;1 year =
&nbsp;1=C2=BDY</font></div><div><font face=3D"Andale =
Mono">&nbsp;93962106.0 &nbsp; &nbsp; &nbsp; 2.98y &nbsp;2 years, 11 =
months &nbsp;2 years, 11 months &nbsp; &nbsp; &nbsp; 2 years &nbsp; =
&nbsp; &nbsp; 3 years &nbsp;3Y</font></div><div><font face=3D"Andale =
Mono">216112843.8 &nbsp; &nbsp; &nbsp; 6.85y &nbsp;6 years, 10 months =
&nbsp;6 years, 10 months &nbsp; &nbsp; &nbsp; 6 years &nbsp; &nbsp; =
&nbsp; 7 years &nbsp;7Y</font></div><div><font face=3D"Andale =
Mono">497059540.7 &nbsp; &nbsp; &nbsp;15.75y &nbsp;15 years, 9 months =
&nbsp;15 years, 9 months &nbsp; &nbsp; &nbsp;15 years &nbsp; &nbsp; =
&nbsp;16 years &nbsp;16Y</font></div><div><br></div></div><div><span =
style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">The last =
column is obviously the most compact while still conveying a good amount =
of information, but the 1yr mastodon and normal READABLE s-to-s are also =
quite good (effectively equivalent to magit--age) for a quick glance and =
maintaining ~constant widths. &nbsp;I do find it awkward to set =
the&nbsp;</span><span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, =
0, 0);">RESOLUTION argument to&nbsp;</span><span style=3D"caret-color: =
rgb(0, 0, 0); color: rgb(0, 0, 0);">&gt;30 million seconds to achieve =
this. &nbsp;It took me a bit to understand what this argument =
does.&nbsp;</span></div><div><br></div><div>Code use to =
produce:</div></div><div><br></div><div><div><font face=3D"Andale =
Mono">(concat</font></div><div><font face=3D"Andale Mono">&nbsp;(format =
"%11s &nbsp;%10s &nbsp;%18s &nbsp;%18s &nbsp;%12s &nbsp;%12s &nbsp;%s\n" =
"Delay (s)" "s-to-s"</font></div><div><font face=3D"Andale Mono">&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;"mastodon" "mastodon (3600s)" "mast (1yr)" =
"s-to-s (rdb)" "s-to-s (rdb=3Dabbrev, half)")</font></div><div><font =
face=3D"Andale Mono">&nbsp;(cl-loop for s =3D 0.45 then (* s 2.3) while =
(&lt; s (* 365.25 24 3600 22))</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; concat (format "%11.1f =
&nbsp;%10s &nbsp;%18s &nbsp;%18s &nbsp;%12s &nbsp;%12s &nbsp;%s\n" =
s</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(seconds-to-string s)</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;(car (mastodon-tl--human-duration =
s))</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(car (mastodon-tl--human-duration s 3600))</font></div><div><font =
face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(car =
(mastodon-tl--human-duration s (* 365.25 24 =
3600)))</font></div><div><font face=3D"Andale Mono">&nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;(seconds-to-string s t)</font></div><div><font face=3D"Andale =
Mono">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;(seconds-to-string s 'abbrev =
'half))))</font></div></div><div><br></div></div></body></html>=

--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Disposition: attachment;
	filename=time-data-readable-seconds.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="time-data-readable-seconds.patch"
Content-Transfer-Encoding: quoted-printable

---=20time-date.el=092024-06-22=2021:51:21=0A+++=20time-date_new.el=09=
2024-06-22=2021:53:13=0A@@=20-406,10=20+406,41=20@@=0A=20=20=20=20=20=20=20=
=20=20(list=20(*=203600=2024=20400)=20"d"=20(*=203600.0=2024.0))=0A=20=20=
=20=20=20=20=20=20=20(list=20nil=20"y"=20(*=20365.25=2024=203600)))=0A=20=
=20=20"Formatting=20used=20by=20the=20function=20`seconds-to-string'.")=0A=
+=0A+(defvar=20seconds-to-string-readable=0A+=20=20`(("Y"=20"year"=20=20=20=
"years"=20=20=20,(round=20(*=2060=2060=2024=20365.2425)))=0A+=20=20=20=20=
("M"=20"month"=20=20"months"=20=20,(round=20(*=2060=2060=2024=20=
30.436875)))=0A+=20=20=20=20("w"=20"week"=20=20=20"weeks"=20=20=20,(*=20=
60=2060=2024=207))=0A+=20=20=20=20("d"=20"day"=20=20=20=20"days"=20=20=20=
=20,(*=2060=2060=2024))=0A+=20=20=20=20("h"=20"hour"=20=20=20"hours"=20=20=
=20,(*=2060=2060))=0A+=20=20=20=20("m"=20"minute"=20"minutes"=2060)=0A+=20=
=20=20=20("s"=20"second"=20"seconds"=201))=0A+=20=20"Formatting=20used=20=
by=20the=20function=20`seconds-to-string'=20with=20READABLE=20set.")=0A+=0A=
=20;;;###autoload=0A-(defun=20seconds-to-string=20(delay)=0A-=20=20=
"Convert=20the=20time=20interval=20in=20seconds=20to=20a=20short=20=
string."=0A-=20=20(cond=20((>=200=20delay)=20(concat=20"-"=20=
(seconds-to-string=20(-=20delay))))=0A+(defun=20seconds-to-string=20=
(delay=20&optional=20readable=20half)=0A+=20=20"Convert=20the=20time=20=
interval=20in=20seconds=20to=20a=20short=20string.=0A+If=20READABLE=20is=20=
non-nil,=20convert=20DELAY=20into=20a=20readable=20string.=20=20If=20it=20=
is=0A+the=20value=20`abbrev',=20abbreviate=20the=20units.=20=20If=20HALF=20=
is=20set,=20round=20to=20the=0A+nearest=20half=20unit."=0A+=20=20(cond=20=
((>=200=20delay)=20(concat=20"-"=20(seconds-to-string=20(-=20delay)=20=
readable=20half)))=0A+=20=20=20=20=20=20=20=20(readable=0A+=20=20=20=20=20=
=20=20=20=20(let=20((abbrev=20(eq=20readable=20'abbrev))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20(stsa=20seconds-to-string-readable)=0A+=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20here=20cnt)=0A+=20=20=20=20=20=20=20=
=20=20=20=20(if=20(=3D=20(round=20delay=20(if=20half=200.5=201.))=200)=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(format=20"0%s"=20(if=20=
abbrev=20"s"=20"=20seconds"))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=
(while=20(and=20(setq=20here=20(pop=20stsa))=20stsa=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(<=20(/=20delay=20=
(nth=203=20here))=201)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(setq=20=
cnt=20(round=20(/=20(float=20delay)=20(nth=203=20here))=20(if=20half=20=
0.5=201.)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20(concat=0A+=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20(let=20((c=20(if=20half=20(/=20cnt=202)=20=
cnt)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20(>=20c=20=
0)=20(number-to-string=20c)=20""))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(if=20(and=20half=20(=3D=20(mod=20cnt=202)=201))=20"=C2=BD"=20"")=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20abbrev=20""=20"=20")=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(cond=20(abbrev=20(car=20=
here))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
((<=3D=20cnt=20(if=20half=202=201))=20(nth=201=20here))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20(nth=202=20here)))))))=0A=
=20=20=20=20=20=20=20=20=20((=3D=200=20delay)=20"0s")=0A=20=20=20=20=20=20=
=20=20=20(t=20(let=20((sts=20seconds-to-string)=20here)=0A=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(while=20(and=20(car=20(setq=20here=20(pop=20=
sts)))=0A=

--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div></div></body></html>
--Apple-Mail=_BAAFEC3A-8FE1-4F22-84C3-4558A83F7E88--

--Apple-Mail=_7B0A21E6-71E7-4D62-AA68-5822ED656ACB--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 22 Jun 2024 23:42:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 19:42:37 2024
Received: from localhost ([127.0.0.1]:36246 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sLANR-0000hj-2m
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 19:42:37 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:44882)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1sLANP-0000hR-Bl
 for 71572 <at> debbugs.gnu.org; Sat, 22 Jun 2024 19:42:36 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 9390E3C011BC5;
 Sat, 22 Jun 2024 16:42:29 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP
 id xm0rGX843nsd; Sat, 22 Jun 2024 16:42:27 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 6CE413C011BE0;
 Sat, 22 Jun 2024 16:42:27 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6CE413C011BE0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1719099747;
 bh=VfHaxLAwpzqvcNkXkojshlUtOU6+mo6htO/OgdaNH9w=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=ONqaeR7FPi+0coUuRTXQrwdzzexrJJkJY7Q7j53uu6Puhj6NRXbReoSiLur+C7/zv
 t+/LgAyGnBZFmoa9Ltu2nDZrgxsVYrDqgSkoiaWzBoAelOhbxvGfNILc3k0pAxJGFe
 0jK/e4YMro70FjgPUNTrCK5h5Ie2ooMIsLeZV/rW+TG078Sp1jlKFfBkt2IcHWjZUg
 enueuIqwMIrxQ9KSqV6tMXV1a6lxru6M9IjLKhCejZNgwvP2ViHacD6bvjwkiAS64v
 vFUmT6i7iGnx359F3A0F9IS7UVOnzY36K9KF7AFiWW9+NEtSQ4knNtakcPjXmLtx6I
 XnVjTiOsGyR6w==
X-Virus-Scanned: amavis at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP
 id ZZZxdHxlwFk6; Sat, 22 Jun 2024 16:42:27 -0700 (PDT)
Received: from [192.168.184.241] (unknown [165.166.182.66])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id D9D903C011BC5;
 Sat, 22 Jun 2024 16:42:26 -0700 (PDT)
Message-ID: <fddd785b-344e-4f65-a8f2-527c6c3a6d1b@HIDDEN>
Date: Sat, 22 Jun 2024 19:42:25 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
To: Eli Zaretskii <eliz@HIDDEN>, JD Smith <jdtsmith@HIDDEN>
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
 <86r0cpicwt.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
In-Reply-To: <86r0cpicwt.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 3.5 (+++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 6/22/24 04:45, Eli Zaretskii wrote: >> Cc: Adam Porter
 <adam@HIDDEN>, jonas@HIDDEN >> From: JD Smith <jdtsmith@HIDDEN>
 >> Date: Sat, 15 Jun 2024 13:24:00 -0400 >> >> A very useful and [...] 
 Content analysis details:   (3.5 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
 [165.166.182.66 listed in zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 71572
Cc: adam@HIDDEN, 71572 <at> debbugs.gnu.org, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 2.5 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  On 6/22/24 04:45, Eli Zaretskii wrote: >> Cc: Adam Porter
   <adam@HIDDEN>, jonas@HIDDEN >> From: JD Smith <jdtsmith@HIDDEN>
    >> Date: Sat, 15 Jun 2024 13:24:00 -0400 >> >> A very useful and [...] 
 
 Content analysis details:   (2.5 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  3.6 RCVD_IN_SBL_CSS        RBL: Received via a relay in Spamhaus SBL-CSS
                             [165.166.182.66 listed in zen.spamhaus.org]
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager

On 6/22/24 04:45, Eli Zaretskii wrote:
>> Cc: Adam Porter <adam@HIDDEN>, jonas@HIDDEN
>> From: JD Smith <jdtsmith@HIDDEN>
>> Date: Sat, 15 Jun 2024 13:24:00 -0400
>>
>> A very useful and widely used time operation is to approximate a given=
 delay or age (in seconds) using a human-readable unit =E2=80=94 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 mean=
ingful "human readable" duration units like weeks and months, and uses ab=
breviated 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 othe=
r packages have adapted it.  It would be useful to have a version in core=
.
>>
>> This patch provides a `seconds-to-string-approximate' function based l=
oosely on `magit--age' and `seconds-to-string'.  It allows using abbrevia=
ted or full units, and can optionally round to the nearest half-unit.
>=20
> Paul, any comments to the patch?

For starters:

Why define a new function, instead of adding optional arguments to the=20
existing one?

Why not look at what mastodon.el does, as the comment in=20
seconds-to-string suggests? For example, mastodon-tl--human-duration=20
lets you specify whatever resolution you want, instead of limiting you=20
to either 0.5 or 1  as in the proposed patch.

Isn't the master branch was in an long-term sort-of-frozen state, until=20
a branch is created for Emacs 30? If so I imagine changes in this area=20
should wait.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 22 Jun 2024 21:56:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 17:56:45 2024
Received: from localhost ([127.0.0.1]:33470 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sL8iy-0005va-Un
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 17:56:45 -0400
Received: from crab.oak.relay.mailchannels.net ([23.83.215.42]:54329)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <adam@HIDDEN>) id 1sL8ix-0005vQ-75
 for 71572 <at> debbugs.gnu.org; Sat, 22 Jun 2024 17:56:43 -0400
X-Sender-Id: dreamhost|x-authsender|adam@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id A9EAF5C1F21;
 Sat, 22 Jun 2024 21:56:41 +0000 (UTC)
Received: from pdx1-sub0-mail-a235.dreamhost.com (unknown [127.0.0.6])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 54B3F5C16AB;
 Sat, 22 Jun 2024 21:56:41 +0000 (UTC)
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1719093401; a=rsa-sha256;
 cv=none;
 b=VWkyaLFmFfOyTuQtUMfixVFIaFrj8GZJXlxGuYwBwxUA8VJPiFVIAHBnjAqQw+C89xefmw
 xP4JYM4yGEAACEOyhvkOTi5IM058S5NnJuQt/MOd9DuuQXNL1rM8hQ9d3Dv9URuGZJt+Hp
 QJqERbrk9vEQ04liFbvkOBMhPIgfjNzVsiJpUVcM/JXaE8HyvlBfrtYBUfJ7vAY9EJ6gDt
 o+yO6fPMYwrCLez7/1BKBPMEtwnVy0Nhc4jHs60WGtvtWg08edKPw1lJTaT+/Shp8xpMeI
 FBsjW+H88+0qlnbeqrUPi9Ci/5gr3Y/G8jv+eMH9OWHTuWJZ2pbLZnQOiMfHvg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
 d=mailchannels.net; s=arc-2022; t=1719093401;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references:dkim-signature;
 bh=eSKRsPT74GkfYnbCqCE8EJtI34StjHqHOT8QDV8tdLQ=;
 b=qSnHTQ1jF1COltz2nyYsC8YxN5p9SBO3cKZzaGD434xAVGZIdTD/R7rRyEaaK6eI3QCYIc
 ROgnl7tUqcEeUDGLfp/jEXstlbm+4HIe4Jme5RNLv+eiiinkCe7Y5tIm606GMTQFvDCvVs
 5X9DR6otcqmB/VC+NtyDc5nccRtuOYUrhnig+y7YSGR5haGP6+EudVDk0b8HeXzF7CQ2eM
 3nzOrIPaHsedRqtZFGYgvqag6Ugj8Oc1RdXbR5aXmg0NFcPVv3eNtCANLsvJTsyfjcYhjC
 C1IglOen4ZpaLolx9mjhzlUr3YE36pVIbn+nVDq2SrczNns2jkebVs5LJoiFhA==
ARC-Authentication-Results: i=1; rspamd-79677bdb95-965kd;
 auth=pass smtp.auth=dreamhost smtp.mailfrom=adam@HIDDEN
X-Sender-Id: dreamhost|x-authsender|adam@HIDDEN
X-MC-Relay: Junk
X-MailChannels-SenderId: dreamhost|x-authsender|adam@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Versed-Daffy: 1fa990c756dccb08_1719093401592_2373822015
X-MC-Loop-Signature: 1719093401592:1901154522
X-MC-Ingress-Time: 1719093401592
Received: from pdx1-sub0-mail-a235.dreamhost.com (pop.dreamhost.com
 [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384)
 by 100.121.33.136 (trex/6.9.2); Sat, 22 Jun 2024 21:56:41 +0000
Received: from [10.17.178.125] (unknown [172.98.33.7])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 (Authenticated sender: adam@HIDDEN)
 by pdx1-sub0-mail-a235.dreamhost.com (Postfix) with ESMTPSA id 4W67NS4P5fz2D; 
 Sat, 22 Jun 2024 14:56:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alphapapa.net;
 s=dreamhost; t=1719093401;
 bh=eSKRsPT74GkfYnbCqCE8EJtI34StjHqHOT8QDV8tdLQ=;
 h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding;
 b=IR23DR+eIedIpVfkkC1O1lHIfHEIF+5qg93dEqSeakdgqNuNrCDVb8Gacto/zATxa
 R428snOCM7JwdehdoqbXjr/o638nohwkvJNJoRCsCRPUZAEQOLHFWD3FH6WcFsykp4
 6SasfFMYYcdpI6N7gUKA3DYvbizOWlYR1Ws9n/xpK+L7sdgZ/2qwAQoJcj8EEuVfc7
 ywwavyLod944dqngjp9Tn5fBP33FhgzuBu2PDrq9m7CIpW83pV+J+Dc4AmHyceFf/y
 4tuRTKcPmBa30BBaA4XEk0f/OyI9mcZzc7YDmId9bLyI2hJO2w5h2tGa3SzFJY0Mdc
 YNNyUkXgQ7peg==
Message-ID: <86def446-b00d-4127-b5eb-b3fd7859e869@HIDDEN>
Date: Sat, 22 Jun 2024 16:56:39 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
To: Eli Zaretskii <eliz@HIDDEN>, JD Smith <jdtsmith@HIDDEN>,
 Paul Eggert <eggert@HIDDEN>
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
 <86r0cpicwt.fsf@HIDDEN>
Content-Language: en-US
From: Adam Porter <adam@HIDDEN>
In-Reply-To: <86r0cpicwt.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.6 (/)
X-Debbugs-Envelope-To: 71572
Cc: 71572 <at> debbugs.gnu.org, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.4 (/)

May I also recommend that the function be benchmarked, and potentially 
that it be profiled and optimized if needed?  A function like this may 
be used on hundreds or even thousands of items in a single operation 
(e.g. formatting a long list of items into a vtable), so it's important 
that it not be too slow.  I don't think I've seen mention of performance 
yet (forgive me if I missed it).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.

Message received at 71572 <at> debbugs.gnu.org:


Received: (at 71572) by debbugs.gnu.org; 22 Jun 2024 08:45:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 04:45:37 2024
Received: from localhost ([127.0.0.1]:44338 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sKwNM-0000AE-NJ
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2024 04:45:37 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1sKwNK-0000A1-Ub
 for 71572 <at> debbugs.gnu.org; Sat, 22 Jun 2024 04:45:36 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1sKwND-0008Ow-2o; Sat, 22 Jun 2024 04:45:27 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=9aD5uk5ae2313Kw03hBKg5dYtZojPx4ohBB/+gJ92ag=; b=LyOHKdU5CnHvAWBh8fln
 VW8RL+qxDARzBxUD2pZvNABXWZcMSvCC0nQrrMKzea+QyEMHyUX2vR7xXaVJj2vbJfRo9nqm+k6L/
 oTUfwzk+BE/isUNG6Zy7QTZiJ8mGX0riAmUdvP4hqLLeaPU5TwhadjKsVQkJJ3ccWtNbR056UAySO
 bYsa8UHJ6gJb/eBu6Hzv8qE55exgyxO0YRlxhhuk/iTlfybF0RcwWk2gvlmikqMBb6pBQqIkcrJiw
 QjinC9sZqepJDLYjmPsD2Joy7qtyU9ov+l5XOyZuPAkyWuz2twNvrMHR1/0u+7fEwN22dZn7HyWdu
 w2EcdZKSgiKDwg==;
Date: Sat, 22 Jun 2024 11:45:22 +0300
Message-Id: <86r0cpicwt.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: JD Smith <jdtsmith@HIDDEN>, Paul Eggert <eggert@HIDDEN>
In-Reply-To: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN> (message from JD
 Smith on Sat, 15 Jun 2024 13:24:00 -0400)
Subject: Re: bug#71572: [PATCH] seconds-to-string-approximate
References: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 71572
Cc: adam@HIDDEN, 71572 <at> debbugs.gnu.org, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: Adam Porter <adam@HIDDEN>, jonas@HIDDEN
> From: JD Smith <jdtsmith@HIDDEN>
> Date: Sat, 15 Jun 2024 13:24:00 -0400
> 
> 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.

Paul, any comments to the patch?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.
Merged 71572 71573. Request was from Eli Zaretskii <eliz@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Jun 2024 17:24:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 15 13:24:25 2024
Received: from localhost ([127.0.0.1]:34681 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sIX8a-0004A0-TH
	for submit <at> debbugs.gnu.org; Sat, 15 Jun 2024 13:24:25 -0400
Received: from lists.gnu.org ([209.51.188.17]:40970)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jdtsmith@HIDDEN>) id 1sIX8X-00049g-Vh
 for submit <at> debbugs.gnu.org; Sat, 15 Jun 2024 13:24:23 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1sIX8W-0004Uh-Rb
 for bug-gnu-emacs@HIDDEN; Sat, 15 Jun 2024 13:24:20 -0400
Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1sIX8S-0008FO-Gx
 for bug-gnu-emacs@HIDDEN; Sat, 15 Jun 2024 13:24:18 -0400
Received: by mail-qk1-x734.google.com with SMTP id
 af79cd13be357-7953f1dcb01so246213885a.3
 for <bug-gnu-emacs@HIDDEN>; Sat, 15 Jun 2024 10:24:15 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1718472254; x=1719077054; darn=gnu.org;
 h=to:cc:date:message-id:subject:mime-version:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=tEgXJ0zt2kVwQ7fz1Bay67qQEr2ZrCy6pptRY+wP0hA=;
 b=DNxRcji5wZt4+zQpLfoVYJJIqIIGVqe8X5vgMBh6fiJHwkNYYvCQL2OeMuS1atN9Z9
 Qm/ZH7lTYDJgJiHagQQhJfSd3i422idtV6ZN/BDn+FOj28x1UR8PWcwlf7IRQrZu47wX
 2y4YgoR7z0y3cEuj/LRjrFMJupKK52Vis8dnI32hRtmCCpA4OjKSqthzZ00d9/XDqINP
 rJQzCA22SUpMR6ObM9TP3lZU/78oc1UVFXErjkoFJk+gvWviVxjMshYs59W5cZvef0iv
 ITFhmd4CuIIsZEQErU6XEl+stvtF+PoUBXcdC8ofOS/mV4ug1pj24ePfMQ47HSnv6rfN
 6clQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1718472254; x=1719077054;
 h=to:cc:date:message-id:subject:mime-version:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=tEgXJ0zt2kVwQ7fz1Bay67qQEr2ZrCy6pptRY+wP0hA=;
 b=I0J9+JZknYhFg+VcUZCs70CNcDoMjaEYPXcel+WRPPk17vyL2VqmBkfv9IbvSRE4UO
 nXwQvFDdmXeh8FJsSqxirMAfrTBfMOld+pnV7Eb+vumhUCE7LabWLoMwsKtCCsqA1/cS
 N2PRVDGiD7rILx4DMexKSYqXNkrmiPybRXShdR34GmZ9q9L9XnaBWkgjC1lIO/4Wg7tv
 z18bOZUn9pDg3zLq7GmWFw5ZRS4eA1DsjK8QITkKgeKZ7nihk04kGof5iU637RlIiBnT
 KKcKl5qmSNGt4gsmotu9pHReae4vJ8JaCHDKH1zgwmu6UV3ltotrZUsDWD4jsJpT0uqX
 Of6g==
X-Gm-Message-State: AOJu0Yz9lMaXczWagCmkQ0jYNjkDDW6ogiM6bcJBKQE+Y/ZeOL+uRwq2
 ZYgJt9a1h5/7+2tYaf6rtykxM4UurNK0MKgtVOiS9vfELoCdGzYVf6NBiA==
X-Google-Smtp-Source: AGHT+IEYqAEllbKn9bIHhxWIUOJq1ZlStZPX8gi/B2KBjS4lwQqNL/rxZYlI7dI3HdxS0W5B0OSYnw==
X-Received: by 2002:a05:620a:254b:b0:795:4745:df49 with SMTP id
 af79cd13be357-798d26a392amr629568085a.65.1718472253775; 
 Sat, 15 Jun 2024 10:24:13 -0700 (PDT)
Received: from smtpclient.apple (cm-24-53-187-34.buckeyecom.net.
 [24.53.187.34]) by smtp.gmail.com with ESMTPSA id
 af79cd13be357-798aaeeba56sm263067185a.52.2024.06.15.10.24.12
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 15 Jun 2024 10:24:13 -0700 (PDT)
From: JD Smith <jdtsmith@HIDDEN>
Content-Type: multipart/mixed;
 boundary="Apple-Mail=_DF256C8E-CD44-4309-983F-3A06CCC42DF6"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: [PATCH] seconds-to-string-approximate
Message-Id: <D91AFAEE-C909-4238-AFF2-226727D4B0F6@HIDDEN>
Date: Sat, 15 Jun 2024 13:24:00 -0400
To: bug-gnu-emacs@HIDDEN
X-Mailer: Apple Mail (2.3774.600.62)
Received-SPF: pass client-ip=2607:f8b0:4864:20::734;
 envelope-from=jdtsmith@HIDDEN; helo=mail-qk1-x734.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Adam Porter <adam@HIDDEN>, jonas@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


--Apple-Mail=_DF256C8E-CD44-4309-983F-3A06CCC42DF6
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

A very useful and widely used time operation is to approximate a given =
delay or age (in seconds) using a human-readable unit =E2=80=94 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. =20

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.


--Apple-Mail=_DF256C8E-CD44-4309-983F-3A06CCC42DF6
Content-Disposition: attachment;
	filename=seconds-to-string-approximate.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="seconds-to-string-approximate.patch"
Content-Transfer-Encoding: quoted-printable

diff=20--git=20a/lisp/calendar/time-date.el=20=
b/lisp/calendar/time-date.el=0Aindex=20eca80f1e8b6..079001bafe2=20100644=0A=
---=20a/lisp/calendar/time-date.el=0A+++=20b/lisp/calendar/time-date.el=0A=
@@=20-420,6=20+420,37=20@@=20seconds-to-string=0A=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(<=3D=20(car=20=
here)=20delay)))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20(concat=20=
(format=20"%.2f"=20(/=20delay=20(car=20(cddr=20here))))=20(cadr=20=
here))))))=0A=20=0A+(defvar=20seconds-to-string-approximate=0A+=20=20=
`(("Y"=20"year"=20=20=20"years"=20=20=20,(round=20(*=2060=2060=2024=20=
365.2425)))=0A+=20=20=20=20("M"=20"month"=20=20"months"=20=20,(round=20=
(*=2060=2060=2024=2030.436875)))=0A+=20=20=20=20("w"=20"week"=20=20=20=
"weeks"=20=20=20,(*=2060=2060=2024=207))=0A+=20=20=20=20("d"=20"day"=20=20=
=20=20"days"=20=20=20=20,(*=2060=2060=2024))=0A+=20=20=20=20("h"=20=
"hour"=20=20=20"hours"=20=20=20,(*=2060=2060))=0A+=20=20=20=20("m"=20=
"minute"=20"minutes"=2060)=0A+=20=20=20=20("s"=20"second"=20"seconds"=20=
1))=0A+=20=20"Formatting=20used=20by=20the=20function=20=
`seconds-to-string-approximate'.")=0A+;;;###autoload=0A+(defun=20=
seconds-to-string-approximate=20(delay=20&optional=20abbreviate=20half)=0A=
+=20=20"Convert=20the=20time=20interval=20DELAY=20in=20seconds=20to=20a=20=
string=20approximation.=0A+Abbreviate=20the=20units=20if=20ABBREVIATE=20=
is=20non-nil.=20=20If=20HALF=20is=20non-nil,=0A+round=20to=20the=20=
nearest=20half-unit,=20otherwise=20round=20to=20the=20nearest=20unit."=0A=
+=20=20(cond=20((>=200=20delay)=0A+=20=20=20=20=20=20=20=20=20(concat=20=
"-"=20(seconds-to-string-approximate=20(-=20delay)=20abbreviate=20=
half)))=0A+=20=20=20=20=20=20=20=20((=3D=20(round=20delay=20(if=20half=20=
0.5=201.))=200)=0A+=20=20=20=20=20=20=20=20=20(format=20"0%s"=20(if=20=
abbreviate=20"s"=20"=20seconds")))=0A+=20=20=20=20=20=20=20=20(t=20(let=20=
((stsa=20seconds-to-string-approximate)=20here=20cnt)=0A+=20=20=20=20=20=20=
=20=20=20=20=20=20=20(while=20(and=20(setq=20here=20(pop=20stsa))=20stsa=0A=
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20(<=20(/=20delay=20(nth=203=20here))=201)))=0A+=20=20=20=20=20=20=20=20=
=20=20=20=20=20(setq=20cnt=20(round=20(/=20(float=20delay)=20(nth=203=20=
here))=20(if=20half=200.5=201.)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20(concat=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(let=20((c=20(if=20=
half=20(/=20cnt=202)=20cnt)))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20(if=20(>=20c=200)=20(number-to-string=20c)=20""))=0A+=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20(if=20(and=20half=20(=3D=20(mod=20cnt=202)=20=
1))=20"=C2=BD"=20"")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20(if=20=
abbreviate=20""=20"=20")=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
(cond=20(abbreviate=20(car=20here))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20((<=3D=20cnt=20(if=20half=202=201))=20(nth=201=20=
here))=0A+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(t=20=
(nth=202=20here))))))))=0A+=0A=20(defun=20date-days-in-month=20(year=20=
month)=0A=20=20=20"The=20number=20of=20days=20in=20MONTH=20in=20YEAR."=0A=
=20=20=20(unless=20(and=20(numberp=20month)=20(<=3D=201=20month=2012))=0A=

--Apple-Mail=_DF256C8E-CD44-4309-983F-3A06CCC42DF6--




Acknowledgement sent to JD Smith <jdtsmith@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#71572; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 30 Jun 2024 05:45:02 UTC

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