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: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>, JD Smith <jdtsmith <at> gmail.com>
Cc: adam <at> alphapapa.net, 71572 <at> debbugs.gnu.org, jonas <at> bernoul.li
Subject: bug#71572: [PATCH] seconds-to-string-approximate
Date: Thu, 4 Jul 2024 08:09:08 +0100
On 7/4/24 06:29, Eli Zaretskii wrote:

> Basically, this shows that:
> 
>   . mastodon truncates where seconds-to-string rounds

For high precision timestamps it's often better to truncate, for various 
reasons. That's what the C code does with timestamps, anyway. 
seconds-to-string historically has rounded several times which of course 
is not best but apparently is good enough for its intended application area.


>   . seconds-to-string lacks the "1 hour 11 min" output format

That format could be confusing with negative delays, e.g., "-1 hour 11 min".

>   . seconds-to-string sometimes produces inaccurate results, as in
>     5.5 => 5.48s

No, it's the other way round: seconds-to-string is more accurate than 
the alternatives. That's merely a misfeature in the test script. 
seconds-to-string is passed the argument 5.475149999999998, and formats 
it as "5.48" whereas the test script formats it as "5.5".


I'm not sold on the "half" argument; seems like a cuteness rather than a 
feature that's all that useful (among other things, it assumes Unicode 
or something like it). What's really going on here is that there's an 
optional argument specifying style and I imagine that style preferences 
will differ (Mastodon style, etc.).

I imagine that style preferences could proliferate. Is there an ISO or 
similar standard for this sort of thing?





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.