From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#71572: [PATCH] seconds-to-string-approximate Date: Thu, 4 Jul 2024 08:09:08 +0100 Message-ID: <3530cd89-b5a2-4b25-95bf-1896c8ee4aef@cs.ucla.edu> References: <86r0cpicwt.fsf@gnu.org> <86msmxafog.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15448"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: adam@alphapapa.net, 71572@debbugs.gnu.org, jonas@bernoul.li To: Eli Zaretskii , JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 04 09:10:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPGbk-0003oF-UK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Jul 2024 09:10:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPGbS-0004lI-Vt; Thu, 04 Jul 2024 03:10:03 -0400 Original-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 ) id 1sPGbS-0004l3-1t for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2024 03:10:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPGbR-0006ok-JI for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2024 03:10:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sPGbS-0004lP-II for bug-gnu-emacs@gnu.org; Thu, 04 Jul 2024 03:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jul 2024 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71572 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71572-submit@debbugs.gnu.org id=B71572.172007696318249 (code B ref 71572); Thu, 04 Jul 2024 07:10:02 +0000 Original-Received: (at 71572) by debbugs.gnu.org; 4 Jul 2024 07:09:23 +0000 Original-Received: from localhost ([127.0.0.1]:41360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPGao-0004kH-MC for submit@debbugs.gnu.org; Thu, 04 Jul 2024 03:09:22 -0400 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]:43652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPGam-0004k3-Id for 71572@debbugs.gnu.org; Thu, 04 Jul 2024 03:09:21 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id B5EC83C011BE0; Thu, 4 Jul 2024 00:09:12 -0700 (PDT) Original-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 vnFY93xTxQ_o; Thu, 4 Jul 2024 00:09:12 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 43FDC3C013279; Thu, 4 Jul 2024 00:09:12 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 43FDC3C013279 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1720076952; bh=RpBoiHM/6ddD/J2GUB5DD7hrTOH4vBrqWRJfwyaSE1Y=; h=Message-ID:Date:MIME-Version:To:From; b=h3HTGLxsP5GZ36ZdbU/yWjyTnH5DAWy0QhoEWD/O/+eGxLKqUAX86daMx0OHMvBtb TEMRhkPMgRzPGCftDYIp2F7Pe2xbdw8eDMDymI1LVDNqN0uwy9wiZSpsDv+HMlmLs3 v8cczpAd9lhTg+32lKjEKhlOWMAJOpNGNbV8QvEHKtpnrQl7YbaT9KLKb0xFyJK4pM /vX5K7mTZVsu++08Z+ucpVWXbtrPxKM1yrupO03AevhLG5f4EtehtyxfVKZzsfvRwI U9fZKddAzBNfnlQUuZecy+lxcmQFJWMAJBPXmzqttayoGPUNMR5dkwK/5zJtCoRagX rx3DYf6WrVNIw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-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 58LYn8TZ45n3; Thu, 4 Jul 2024 00:09:12 -0700 (PDT) Original-Received: from [10.0.3.65] (unknown [92.207.175.29]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id E83DC3C011BE0; Thu, 4 Jul 2024 00:09:10 -0700 (PDT) Content-Language: en-US In-Reply-To: <86msmxafog.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288356 Archived-At: 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?