From unknown Sat Aug 16 10:43:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#70322 <70322@debbugs.gnu.org> To: bug#70322 <70322@debbugs.gnu.org> Subject: Status: 30.0.50; format-seconds with %z doesn't handle zero input correctly Reply-To: bug#70322 <70322@debbugs.gnu.org> Date: Sat, 16 Aug 2025 17:43:36 +0000 retitle 70322 30.0.50; format-seconds with %z doesn't handle zero input cor= rectly reassign 70322 emacs submitter 70322 Herman, G=C3=A9za severity 70322 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 06:00:08 2024 Received: (at submit) by debbugs.gnu.org; 10 Apr 2024 10:00:09 +0000 Received: from localhost ([127.0.0.1]:52190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruUkS-0003c2-5X for submit@debbugs.gnu.org; Wed, 10 Apr 2024 06:00:08 -0400 Received: from lists.gnu.org ([2001:470:142::17]:39824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruUkQ-0003ae-6A for submit@debbugs.gnu.org; Wed, 10 Apr 2024 06:00:06 -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 ) id 1ruUkA-0006KM-Va for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 05:59:50 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ruUk8-0004aU-7i for bug-gnu-emacs@gnu.org; Wed, 10 Apr 2024 05:59:50 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a52140ea1b5so31633266b.1 for ; Wed, 10 Apr 2024 02:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712743184; x=1713347984; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=P50QyjqBfVInAwmCbENvvl1iA56ai6RHh+i0uJ5YSoQ=; b=Gg7xY8wYS9f4fLiWXFz0zPu7xbKmi07P+Jr00V4iwrS4AEOfBaeZXuFu4MmLDALL3I 2ez3jmURKSCKWJb3dNjMI41XUXlSA7D6jwoCRnoDACS43Cn0t5USN4WpIqMoaN3w/aJL T/PUSspspizsVbQqqPAGubEkG1/ODtwwQPPYUFJtqqCVlxyfe+nGz5VdcI5h4dVcdbT3 MRd39z3cuEhq1WFatc+epBOgV5c39Zjnjd16gEKhDfR88NipGxnnY2o1rmkUMQbWhHUV 4PtK05+l+nHbiCu33GIPkvydZfQnVzA2X+Q0i7MJ+l9IaSKg9aaah5gWiT5P0NZi9XdD 0Ing== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712743184; x=1713347984; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=P50QyjqBfVInAwmCbENvvl1iA56ai6RHh+i0uJ5YSoQ=; b=LTDk77Y3EW6mprl/XJjXvYWM6go7nilzbZOqbj25P/dwH4MMDobSbxjBMGhGm4ywBf /k/pb7ce0TtO0TuPwkrAOTG3oB20yQSRyW6KLMo09Or/pTUcB3I17UatzowDyHVI7WF/ Dx0SdngiVceLV775/+M4McqPJuj4OgnCHPC/eF+rpi+6AINdGOzBZmUHI40vHNF6bmJu hcDKCsEgPuxZM6LTIbT0I/zLst6Fp6H309YSbPM7xH7afYRL6K39Jfd5v0UV333Z/h6H B3PqrAYj3DMI5oM7CFVXad8z7h4IliEGfXIfxQC/18t3qjnJ93W6/gAxfOYuuak7r8uZ vw1g== X-Gm-Message-State: AOJu0YzgBqnfbcuIJnO8U8tIbwCi5StP4ICkOhNeLShzv/PRmmgHodXD klhZRaUGkf05G2LwWY3mnQn3p3V1oILoJsAcjxpv/CiqwN7r5YCCSczYyMVh X-Google-Smtp-Source: AGHT+IFi7CL9Lj5CT/AL1LBajtnIGfEvl4OIQms8Jy3Hzfc3qBBrkz8QJPgGpM6/S44pBdZjGiLQhw== X-Received: by 2002:a17:906:184a:b0:a52:882:abaa with SMTP id w10-20020a170906184a00b00a520882abaamr1139132eje.76.1712743183921; Wed, 10 Apr 2024 02:59:43 -0700 (PDT) Received: from localhost (netacc-gpn-104-0-194.pool.yettel.hu. [91.104.0.194]) by smtp.gmail.com with ESMTPSA id nb16-20020a1709071c9000b00a51e6222200sm2245946ejc.156.2024.04.10.02.59.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 02:59:43 -0700 (PDT) From: =?utf-8?Q?Herman=2C_G=C3=A9za?= To: bug-gnu-emacs@gnu.org Subject: 30.0.50; format-seconds with %z doesn't handle zero input correctly X-Debbugs-Cc: Date: Wed, 10 Apr 2024 11:59:42 +0200 Message-ID: <87v84pa67l.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=geza.herman@gmail.com; helo=mail-ej1-x633.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 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) When the input seconds is 0, format-seconds emits the full string. For example, (format-seconds "%Y, %D, %H, %M, %z%S" 0) returns "0 years, 0 days, 0 hours, 0 minutes, 0 seconds" instead of "0 seconds". (format-seconds "%Y, %D, %H, %M, %z%S" 1) correctly returns "1 second". In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, cairo version 1.18.0) of 2024-03-23 built on okoska Repository revision: c552cb98ad4ffbec91db52cde71cf3e0fa76e0dc Repository branch: my-modifications Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure --with-native-compilation --without-compress-install --without-gconf --without-gsettings --without-dbus --with-small-ja-dic --with-json --with-xinput2 --with-x-toolkit=no --with-tree-sitter --with-cairo --with-cairo-xcb --disable-silent-rules 'CFLAGS=-mtune=native -march=native -g3 -O3'' Configured features: ACL CAIRO FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM ZLIB Important settings: value of $LC_ALL: C.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=none locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: vertico-multiform-mode: t recentf-mode: t which-key-mode: t global-auto-revert-mode: t savehist-mode: t ws-butler-global-mode: t ws-butler-mode: t diff-hl-flydiff-mode: t global-diff-hl-mode: t clean-aindent-mode: t global-whitespace-mode: t marginalia-mode: t vertico-mode: t global-anzu-mode: t anzu-mode: t global-evil-matchit-mode: t evil-matchit-mode: t evil-snipe-override-mode: t evil-snipe-mode: t evil-snipe-override-local-mode: t evil-snipe-local-mode: t global-evil-surround-mode: t evil-surround-mode: t global-evil-visualstar-mode: t evil-visualstar-mode: t better-jumper-mode: t better-jumper-local-mode: t evil-leader-mode: t global-evil-leader-mode: t global-hl-todo-mode: t winum-mode: t hes-mode: t gcmh-mode: t global-page-break-lines-mode: t evil-mode: t evil-local-mode: t save-place-mode: t override-global-mode: t minibuffer-depth-indicate-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-history-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t abbrev-mode: t Load-path shadows: /home/geza/.emacs.d/elpa/transient-20240226.2332/transient hides /usr/local/share/emacs/30.0.50/lisp/transient ~/.emacs.d/lisp/emacs-gdb/gdb-mi hides /usr/local/share/emacs/30.0.50/lisp/progmodes/gdb-mi Features: (shadow sort project mail-extr emacsbug message mailcap yank-media puny evil-collection-dired dired-git-info peep-dired dired-narrow delsel dired-filter f s dired-aux dired-x dired-subtree dired-hacks-utils evil-collection-wdired wdired ls-lisp dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils mule-util cursor-sensor evil-collection-consult consult-dir vertico-multiform consult-compile compile evil-collection-comint comint ansi-osc ansi-color recentf tree-widget wid-edit shut-up consult bookmark text-property-search pp face-remap drag-stuff which-key autorevert filenotify savehist bm evil-collection-info info ws-butler diff-hl-flydiff diff diff-hl log-view pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode clean-aindent-mode column-enforce-mode whitespace orderless marginalia vertico anzu evil-matchit evil-matchit-evil-setup evil-matchit-sdk semantic/lex semantic/fw eieio eieio-core mode-local find-func evil-exchange evil-args evil-indent-plus evil-textobj-line evil-textobj-entire evil-textobj-column evil-textobj-anyblock evil-snipe evil-surround evil-mc evil-mc-command-execute evil-mc-command-record evil-mc-cursor-make evil-mc-region evil-mc-cursor-state evil-mc-undo evil-mc-vars evil-mc-known-commands evil-mc-common avy evil-visualstar evil-collection-simple evil-collection-replace evil-collection annalist better-jumper pcase cl-macs evil-leader hl-todo compat hl-line transpose-frame winum dash ov highlight-escape-sequences gcmh page-break-lines evil evil-integration evil-maps evil-commands reveal evil-jumps evil-command-window evil-types evil-search evil-ex evil-macros evil-repeat evil-states evil-core evil-common thingatpt rect evil-vars ring edmacro kmacro byte-opt saveplace bind-key easy-mmode advice mb-depth comp cl-seq comp-cstr cl-extra help-mode warnings icons subr-x gv cl-loaddefs cl-lib comp-run bytecomp byte-compile comp-common rx rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads inotify lcms2 dynamic-setting font-render-setting cairo xinput2 x multi-tty move-toolbar make-network-process native-compile emacs) Memory information: ((conses 16 267620 317533) (symbols 48 22835 189) (strings 32 73149 28252) (string-bytes 1 3065253) (vectors 16 36191) (vector-slots 8 422531 144718) (floats 8 230 208) (intervals 56 1888 275) (buffers 984 12)) From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 07:23:24 2024 Received: (at 70322) by debbugs.gnu.org; 10 Apr 2024 11:23:24 +0000 Received: from localhost ([127.0.0.1]:52237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruW31-0004pu-7u for submit@debbugs.gnu.org; Wed, 10 Apr 2024 07:23:24 -0400 Received: from mout.gmx.net ([212.227.15.15]:38495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruW2v-0004oE-02 for 70322@debbugs.gnu.org; Wed, 10 Apr 2024 07:23:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1712748181; x=1713352981; i=stephen.berman@gmx.net; bh=KsK05B3FA53amLpFI4BLn9sD6wvkG4+xPp/X3ntIw5I=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=Y+oYxnWLiyJYbsQdZZvJdAz4a8qQo5Uk9bmTrm0G+jUmRcrXkTY+nRQHWvlL/AUs Ar5ZcPr8grVQlc7+UCrSpJBKcggtG1fVPoe4nL5USmSh8VXbnQg/OepHBneiZ2x4s idehi/R3jhBS7qEcLl3gcR0CA8POp3XH8WfMEKA9+k3UVNY2Tzb38PSptlIEam70b rc/HrFtCAMGXhmHoLX5+d0FwBsYtcy2tOaYuce64gP4lE3XLJFcc9VEgOpgxwutW5 83r1jdifBzDrudLxuM5tQbLjdDQDeO3xq9w9Cfx51r1lJcmcCpbYZsSk1CzpsTE4t PZR/S+uA++JizL0Glw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from strobelfs ([94.134.94.133]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MJVHe-1sEFqu401g-00JuWR; Wed, 10 Apr 2024 13:23:01 +0200 From: Stephen Berman To: Herman@debbugs.gnu.org Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly In-Reply-To: <87v84pa67l.fsf@gmail.com> (Herman@debbugs.gnu.org's message of "Wed, 10 Apr 2024 11:59:42 +0200") References: <87v84pa67l.fsf@gmail.com> Date: Wed, 10 Apr 2024 13:23:00 +0200 Message-ID: <875xwpjwbv.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K1:qYVMyi8inbyfLeusoGKYo/WQ54ovbs4PrBE8izhTRrWKkOJ8QCA +diO2AocEoGz2zWwfZt3GntovUU4jGhbeE84+ibsh51hGzZZ+eTVFhUW7WtKH9W6dr0IdiM vyBO1HAEmRWjYgWnQ9eORIGgXxWZuJhavqaIF6uODTm/mEkQzt4ykvAldIX8D5CHQkta1FD pOE/pF9+l0ScKi0wStlWg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:AoV6oyiSzkM=;4U1xV4csSQExcGsewEPrxnLhMFy NnMvAPZoXYOeEA+scNPOY6DsJtKgfu7322cIhKw9AsMNCfbK3xtE5nQLkvBuhknkHizL49/nD vj2EB0IgjFydTDZQ7cBp6lK1FQ0Ldoum4lKB5jLirbYV1cEvs3KA1NLouhg4qeugMKyFIjfaz K4kmH2I9l5FNav0lD/tWvUUTEGgf9Dn8fTltGO4bXB5MPEHk4JRXCupBZ9Pu8BHcBwfDhc0uZ BtePbyJRagF2T2Itbd/RtQkbgS8YD8kYZDHNajXb+Wu6TJOuCNeQoe4RjD+kfvegUBm/ECflf i4swQ5WPj8ks4hLg/sbJ3MxRfe4QFIvexRThbgDIiQmdOX2qSoF3Aakq79GsQbo3cS1xE/+aC 4b0NsLe4XXgbtcQTy8bXvnYYP1439IBb7nIWRq7bPlGGJRonlMTlJUv/WcE/lgu7sZi2tGuBG uytnIyZxE4Yxghj9qnpL4AMAtIrbT8fMOi7Ymyb7Gf07A+5zLZnZT6+EZga2ngSd+Ewn+NoMN xYn/H4NhJHZTBEobaJBm5q4zmeZ+LkEcdikh4Ejx0ZfcPPLlZVo5+pK0rfE1O+pyh99P95g/3 JXqS/eJe3RNt/4bmnUUoB4Nv/aBv27GR6P/luK3YZaEYwMN9PwiMZHIEA33KS9KpTS5+LZvG5 ATjrhJUEEK2WXBeGCiDvlE2K1HOH+aVtXoyygwqaM/lwyz5PfsmiYTA1FTf6+KVXpDQQdBkap /nAOJAiG74UuSIq5MYynTtmzzee9pea/kBXSf+oyWywPMCjiZdJK3yhiQcGXh9fA/PH3iD7em xMnR5R0J8JhAJRO0r4fBFcGciwj2eWEuF8+C0/5hTrhQI= X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 70322 Cc: =?utf-8?Q?G=C3=A9za?= , 70322@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, 10 Apr 2024 11:59:42 +0200 Herman@debbugs.gnu.org, G=C3=A9za wrote: > When the input seconds is 0, format-seconds emits the full string. For > example, > > (format-seconds "%Y, %D, %H, %M, %z%S" 0) > > returns "0 years, 0 days, 0 hours, 0 minutes, 0 seconds" > > instead of "0 seconds". > > (format-seconds "%Y, %D, %H, %M, %z%S" 1) correctly returns "1 second". The attached patch seems to fix this. Steve Berman --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: format-seconds patch diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index e96e2e7e2db..59e236ce3c5 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -352,9 +352,13 @@ format-seconds ;; Cf article-make-date-line in gnus-art. (setq num (floor seconds unit) seconds (- seconds (* num unit))) - (let ((is-zero (zerop (if (= unit 1) - (+ num fraction) - num)))) + (let ((is-zero (if (and (zerop seconds) (= unit 1)) + ;; Also drop leading units when SECONDS is + ;; 0 (bug#70322). + nil + (zerop (if (= unit 1) + (+ num fraction) + num))))) ;; Start position of the first non-zero unit. (when (and (not leading-zeropos) (not is-zero)) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 07:59:16 2024 Received: (at 70322) by debbugs.gnu.org; 10 Apr 2024 11:59:16 +0000 Received: from localhost ([127.0.0.1]:52294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruWbi-0002Em-7d for submit@debbugs.gnu.org; Wed, 10 Apr 2024 07:59:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruWbe-0002D7-8v for 70322@debbugs.gnu.org; Wed, 10 Apr 2024 07:59:12 -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 ) id 1ruWbQ-00008S-69; Wed, 10 Apr 2024 07:58:56 -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=7tbASEt2zXOHTgKDiliDWw76LXdZvXKD8a7C/oXPLlA=; b=PxEosimHBwaX5cW4GFnF 4xPHbxgAaIX4TAGhraHNfwHEKjCz+sL10ueKeSltL2vFCQc+AVeAvertzwRIqWrlxfr9Zch0WEAeJ LUZPazlVONM4UjDtSl+vltfD6N7+Kf3gmPyUms/RAZbZ7ETq7VkZ1QePmAwvEerNWYEB4ruCJDBWl wC0fnbSENIBoyhlS2vRncWKsg8bD6aBMAJEwXLeGsbd8Exrc7Uinei8je5mWEoy5I6FyU87+0DnMs hS2X1EAkoF3NkDs8n/wzmaHHe1bVSOFy+ZNQoj7KwSl7nt+DJcDVjIGcPuNcoLr5Lx/22qLaCLF0G 2cskqC2LLI1hNQ==; Date: Wed, 10 Apr 2024 14:58:53 +0300 Message-Id: <861q7dwhs2.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Herman_G=C3=A9za?= In-Reply-To: <87v84pa67l.fsf@gmail.com> (Herman@debbugs.gnu.org) Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly References: <87v84pa67l.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70322 Cc: 70322@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Herman@debbugs.gnu.org, Géza > Date: Wed, 10 Apr 2024 11:59:42 +0200 > > > When the input seconds is 0, format-seconds emits the full string. For > example, > > (format-seconds "%Y, %D, %H, %M, %z%S" 0) > > returns "0 years, 0 days, 0 hours, 0 minutes, 0 seconds" > > instead of "0 seconds". > > (format-seconds "%Y, %D, %H, %M, %z%S" 1) correctly returns "1 second". Does the patch below give good results? diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el index e96e2e7..b75f17c 100644 --- a/lisp/calendar/time-date.el +++ b/lisp/calendar/time-date.el @@ -344,8 +344,11 @@ format-seconds string) (cond ((string-equal spec "z") - (setq chop-leading (and leading-zeropos - (min leading-zeropos (match-beginning 0))))) + (setq chop-leading + (if leading-zeropos + (min leading-zeropos (match-beginning 0)) + ;; The entire speci is zero, get past "%z" to last 0. + (+ 2 (match-beginning 0))))) ((string-equal spec "x") (setq chop-trailing t)) (t From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 08:46:02 2024 Received: (at 70322) by debbugs.gnu.org; 10 Apr 2024 12:46:03 +0000 Received: from localhost ([127.0.0.1]:52341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXL0-0000iz-DZ for submit@debbugs.gnu.org; Wed, 10 Apr 2024 08:46:02 -0400 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:53254) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXKw-0000h2-ED for 70322@debbugs.gnu.org; Wed, 10 Apr 2024 08:45:59 -0400 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2d485886545so117418581fa.2 for <70322@debbugs.gnu.org>; Wed, 10 Apr 2024 05:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712753143; x=1713357943; darn=debbugs.gnu.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :references:from:to:cc:subject:date:message-id:reply-to; bh=QaqA5Rv0sw6nB+n9kAPwRpMcQLCzkqf0loHznitbjLE=; b=ezmBXbBvdx7atvllPFOaDF/CUkxKWMYHlVwW80ln22TSt7Ukf8UDBE/dzvWKLLcc0q kxZ48ETGJpbAiol1KuJhPPto0XdajJdZh6/G0r6EqIpeoacc4t/+BGJ8JebeDxcZ/0Y0 5dS6Yq3F55VgmbDfZKYJsEtaTlBmwYaDjeLgiv3v3zeoLkIGd/OW78FRpfEXpeDLZgqc +rXQJLD2Ph8y4HncnA8xxS1tRq+lZ3AcKtDEoKOxN6KYCYt3Z+WkrOM0pLSZTzCTl9OV AhJRFIFvO/FuUbCw/sKaTIgmDFo0un3ykZY9c5On1y9ueD2Omzn5oCku9XU6rZ9XIjlk xPOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712753143; x=1713357943; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :references:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QaqA5Rv0sw6nB+n9kAPwRpMcQLCzkqf0loHznitbjLE=; b=m08pwAcVs520eAABHIZEdlOmX+lIu5wT/pdZ7b4+28ZwnEWZp9O9DShVsR+hQFIl/0 7ryj1TKpguUv35C0YvaE7kboiOPqT/tL9aRzkjBouJFMhrp624L7G2XBPej7zzAyz8bn vFNO6NKY1IEe7I6q0ZBVujG+IrpreDi0TkR99Rq0eNk2+1+irAwqL9U+lWJV+wi5KBcr AInsiYwPrisiWPu8NdclTzAseja/2sLIKpu/yYtVenvfvrH3HVAY2j0bC9zojrxfKAE8 S8e4yOSGG7nyd7OigrxCEcHuDcGupMkAFNNWIRBGPNe9xIw3kR37tuXeiXnR+Kw7Ri+L Dlvw== X-Forwarded-Encrypted: i=1; AJvYcCVmRJ6JOyRMj6PCm3I8V0db7cj+ooampsJJrx7/R0Th67rwsWBrJyOJ8PxYKSs7jL9E6N7GSgwIYUfxB9lv55ZfIVKFCUA= X-Gm-Message-State: AOJu0YzMJ3pVMPMfcfS7tJ4lgEOvEifTOdhz1dYsPzBangSczAoi5BXc VJ04idNizFAQUytY5ycJv0PUEgcXAm/CsJbLskO82/4mlHOiCDhZ X-Google-Smtp-Source: AGHT+IHOkiHcZu8OxweYKtWcYles/kBFkWV4g/FXf4bvLuWBNVCUXsBMfo7e/kz7lVntzbbIBqgAzg== X-Received: by 2002:a2e:9056:0:b0:2d8:6fc4:d0b5 with SMTP id n22-20020a2e9056000000b002d86fc4d0b5mr2162762ljg.8.1712753143107; Wed, 10 Apr 2024 05:45:43 -0700 (PDT) Received: from localhost (62-77-231-86.static.invitel.hu. [62.77.231.86]) by smtp.gmail.com with ESMTPSA id h5-20020a1709060f4500b00a473774b027sm6876703ejj.207.2024.04.10.05.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 05:45:42 -0700 (PDT) References: <87v84pa67l.fsf@gmail.com> <861q7dwhs2.fsf@gnu.org> From: =?utf-8?Q?Herman=2C_G=C3=A9za?= To: Eli Zaretskii Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly Date: Wed, 10 Apr 2024 14:44:52 +0200 In-reply-to: <861q7dwhs2.fsf@gnu.org> Message-ID: <87bk6h8jyi.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70322 Cc: Herman =?utf-8?Q?G=C3=A9za?= , 70322@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > Does the patch below give good results? Yes, both yours and Stephen's patch fix the problem From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 09:01:06 2024 Received: (at 70322) by debbugs.gnu.org; 10 Apr 2024 13:01:07 +0000 Received: from localhost ([127.0.0.1]:52346 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXZU-0002yC-36 for submit@debbugs.gnu.org; Wed, 10 Apr 2024 09:01:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXZJ-0002vI-3Q for 70322@debbugs.gnu.org; Wed, 10 Apr 2024 09:00:55 -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 ) id 1ruXZ4-0003XP-Fr; Wed, 10 Apr 2024 09:00:34 -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=o3Fpqdw/G/XyZYGz0F8JtJxbECyl4ry19nsz3tTM3PQ=; b=Hdcu70Ha6Qabq2XBb5lH MA8o0TG52mE1JruKjNQYa8aZUPTuZzeS1or6KGUrPl67ehVzxVEEsQaJ2S8lhsIhGfkSOB4TMwQlQ DiXlCi0N/d+dsA6XZ5AINdQ+EDnWzEGMkuxRHlzvAzDyjZkvuAzCNMiW33vyZCeA8h3vN3h+sVpXx deNw0nGostFy2BzBs8tWddD4oorGomKeWJgJZJKOLnW0+2PuW5IzI9oLvRpUZJCAO50Pb/N+UAX8q 8hCVYmxEO1ooAk8a99YxTEx6mlMVE5x+Cs7TM/8JnM4pwZjFulmBFQEwOm+y2wLN0vA71+Ir5Uik/ WYJpDA5zPGwMjQ==; Date: Wed, 10 Apr 2024 16:00:30 +0300 Message-Id: <86zfu1v0cx.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?G=C3=A9za_Herman?= , Stephen Berman In-Reply-To: <87bk6h8jyi.fsf@gmail.com> (message from Herman, =?utf-8?Q?G?= =?utf-8?Q?=C3=A9za?= on Wed, 10 Apr 2024 14:44:52 +0200) Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly References: <87v84pa67l.fsf@gmail.com> <861q7dwhs2.fsf@gnu.org> <87bk6h8jyi.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70322 Cc: 70322@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Herman, Géza > Cc: Herman Géza , > 70322@debbugs.gnu.org > Date: Wed, 10 Apr 2024 14:44:52 +0200 > > > Eli Zaretskii writes: > > > Does the patch below give good results? > > Yes, both yours and Stephen's patch fix the problem Thanks. Stephen, any argumentation for which one is better? From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 09:22:34 2024 Received: (at 70322) by debbugs.gnu.org; 10 Apr 2024 13:22:34 +0000 Received: from localhost ([127.0.0.1]:52357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXuJ-0006HN-3c for submit@debbugs.gnu.org; Wed, 10 Apr 2024 09:22:33 -0400 Received: from mout.gmx.net ([212.227.17.21]:37289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruXu3-0006ED-1r for 70322@debbugs.gnu.org; Wed, 10 Apr 2024 09:22:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1712755319; x=1713360119; i=stephen.berman@gmx.net; bh=19dM9hQrkPhW/rMIdc3vEQJrnX5JV/rRxDB48anuhNY=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References: Date; b=IsfV17LV5v4i6AmOPcdmMJGL6LOV8NQ4xAuCf99GdByfCu3cbeWa+e4wMF1NJdWp 0aUUWbaV7l4WvsyseW9PZepxUR9GmEeZWpMTkh76mZbsjSS8hExJF2CPfIxB0J7HW yKBhH2tWbRNB/5hYL+f+HpeEsvH/wkfW5DKSt1b+n2PmTo7kzRz9C/yMmXN1Ckn86 rg4KLD/BZg9Q8Q1AAvHxfPzrpzevQ3F2YHyd/qgHtF7d9Vzbng2sWuc/wdKZT/2mp FYKSkyXdEzQmO/X1NmbvliyVfGJemHwG26+pvcfEVuohsn9klsx9X6A0w6irXu1zI CRCnKhEFxc62wLEAHw== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from strobelfs ([94.134.94.133]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N7zBb-1spPlM30XD-0152RJ; Wed, 10 Apr 2024 15:21:59 +0200 From: Stephen Berman To: Eli Zaretskii Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly In-Reply-To: <86zfu1v0cx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Apr 2024 16:00:30 +0300") References: <87v84pa67l.fsf@gmail.com> <861q7dwhs2.fsf@gnu.org> <87bk6h8jyi.fsf@gmail.com> <86zfu1v0cx.fsf@gnu.org> Date: Wed, 10 Apr 2024 15:21:59 +0200 Message-ID: <871q7djqtk.fsf@gmx.net> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:8Gc1UGw7Wq0y8Vnk7jikZxfGUX5uoUS4yZ8g5lXEAZGHOdRUKr2 dSsTT1FkH10rFCQahWwxEYhSQKWpUeqbAQAj02xgzSVxBcLLiiKR5Elqz+dcuTskQH3WPuq GGxvy8oW11izX47qY2xMRDXan2qH+7jbToDFClRgsf0BgquSu0k2ApO9cj5wjoT8xsilooJ PmEA+RltH+8t2Em95x9qQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:VQjRiM+PK/Q=;/cVtMjA5h8s0VNBzbKpdW7MTtYW Dnue+kbTYgadB/4d+784+sRyxUKJt4pP6Ry7hF+vdNMw95cFcK+YDx83+IeWiSEg8xJwwcNxP odM9N8JrkNvG7NoDXxhaJWvhYSCxc5xmHwO+NN2N7vtybtS+2KeYeRgBCEv9ehLxFMHU9Jh4m KtHPNSvHLAeGBGpmaW8Ah0cv+TIPQE1adUfK2IGKYP7cw6B1I77TE6F2hX4VreN4zYlT+eYOx 4dWLYQUP5BegOXww9oip27SDQT+j+s/PkWReqse0mr/Ii9bACKTCAggM85wSmlPkB5jay/V8y ZmiRdjyeWSkaK14VXOdwBVL+rb6SISVHD2Pw/jrUM8BbD0ChaJ9qDgwLEhtOpGr1eJhOsBcqU fgDKkMYmoJ3V+iN63zVVYJO5SH5yrc/XNw5jWjdkXOj+dDWJy8fx47SzeQwc6GS3PRaIg4BVK F59xgwjqBFnHyd7TjFc5/B7giKY4EnReGQaOYVjyjZD8LKh/AsqE7r2Lnoksk5Afl+YyIH/nl FxmdwaDoEwAomQ6nW/1rX9TnKbU7hyzpKUr5e7MlKTf/hs2bvbcbcT25YCVN8gr1AfPE14PvD 1Wd/bak38P5zC9nzi1oYOr16GvVDp3OU4X4Yn032dXWaAVl1YFSzvQ1TqfGvVzSipIX5LayIf oKMLXz9jho24oFYRBRPwY0S+c83F50S5uYgds3oMiRBO3w+F9Ypy5q5tATkdYQyOLTNFWxrLL mF7L+muROGM2xxdlw8kqP2PWNbDz2vEHKqNGb4TUtS+Dyz7LvtXMrdfeGCleP57E+TWvmeI0w y2rh+DuMwAjcYfVxoTSi4JwMDNq7wiKXFg7UvfUddOwbM= X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70322 Cc: =?utf-8?Q?G=C3=A9za?= Herman , 70322@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) On Wed, 10 Apr 2024 16:00:30 +0300 Eli Zaretskii wrote: >> From: Herman, G=C3=A9za >> Cc: Herman G=C3=A9za , >> 70322@debbugs.gnu.org >> Date: Wed, 10 Apr 2024 14:44:52 +0200 >>=20 >>=20 >> Eli Zaretskii writes: >>=20 >> > Does the patch below give good results? >>=20 >> Yes, both yours and Stephen's patch fix the problem > > Thanks. > > Stephen, any argumentation for which one is better? AFAICT both give the same results, but since yours specifically targets the case where %z is used, which directly addresses the bug report, it is conceptually the better fix. Steve Berman From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 10 10:02:21 2024 Received: (at 70322-done) by debbugs.gnu.org; 10 Apr 2024 14:02:21 +0000 Received: from localhost ([127.0.0.1]:54108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruYWq-0004dq-Of for submit@debbugs.gnu.org; Wed, 10 Apr 2024 10:02:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ruYWj-0004cV-G4 for 70322-done@debbugs.gnu.org; Wed, 10 Apr 2024 10:02:17 -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 ) id 1ruYWV-00060s-58; Wed, 10 Apr 2024 10:01:59 -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=+hpNLLXBqhA7ROwVqIvtOOyOjI2Wy/v3XTZ+Z/PBzZw=; b=rYzC9JQ5isTrwXT7v1aN +rr+0rzSnbRWd8P33E8dnrOo/eCfgpZomt5aoaPVhuWhZDi/fUhB6oO3he47Fq9lvozLaMA3unwCs z7IVYjKlMIQSSJztVenjZZJo+ZbVWwn8iqCvq1jtoX8+G+FiGDkhHGEcaxOyNHYk+ydppmkdh33wP 4W0vA3lYo2X4/A8iBDloawMp5rnNMsAEwlRyY6vyDwjVMydSTo7d78u3UKI1dhXPW2N+I6CIQq/73 B2obMiOTx/XJGFQh8kbEHRL10/u5FT5qPx4AVndDuxqjgPefxfKzwtHEE/aB7y0sD+A+uBP20gaJ0 Cw6MWuO2rk9Tyw==; Date: Wed, 10 Apr 2024 17:01:56 +0300 Message-Id: <86r0fduxij.fsf@gnu.org> From: Eli Zaretskii To: Stephen Berman In-Reply-To: <871q7djqtk.fsf@gmx.net> (message from Stephen Berman on Wed, 10 Apr 2024 15:21:59 +0200) Subject: Re: bug#70322: 30.0.50; format-seconds with %z doesn't handle zero input correctly References: <87v84pa67l.fsf@gmail.com> <861q7dwhs2.fsf@gnu.org> <87bk6h8jyi.fsf@gmail.com> <86zfu1v0cx.fsf@gnu.org> <871q7djqtk.fsf@gmx.net> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 70322-done Cc: 70322-done@debbugs.gnu.org, geza.herman@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stephen Berman > Cc: Géza Herman , > 70322@debbugs.gnu.org > Date: Wed, 10 Apr 2024 15:21:59 +0200 > > On Wed, 10 Apr 2024 16:00:30 +0300 Eli Zaretskii wrote: > > >> From: Herman, Géza > >> Cc: Herman Géza , > >> 70322@debbugs.gnu.org > >> Date: Wed, 10 Apr 2024 14:44:52 +0200 > >> > >> > >> Eli Zaretskii writes: > >> > >> > Does the patch below give good results? > >> > >> Yes, both yours and Stephen's patch fix the problem > > > > Thanks. > > > > Stephen, any argumentation for which one is better? > > AFAICT both give the same results, but since yours specifically targets > the case where %z is used, which directly addresses the bug report, it > is conceptually the better fix. Thanks, so I've now installed my change, and I'm closing this bug. From unknown Sat Aug 16 10:43:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 09 May 2024 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator