From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A277B3858D39; Wed, 13 Dec 2023 12:30:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A277B3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702470634; bh=X5fLmetoWy+ifoUwZKh15UPaxYtWZXzm+S1Mwdh3RCU=; h=From:To:Subject:Date:From; b=ow2vqhfzvdW2G7FKKLE/cs0AVPQcAzfAd6ehaA1ndim+dSf7RJfgxusxOOxxh8ESX 5ZGLg1xqIQDaTD9Wgl985WsLLBvNTZ+NwXyS3gE69UE6z+pkDf4w8hhvFVTHhwCvKh bumqEc3qYiUvzb/DUSPUooXrFTS9IzWD56f1o48g= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-6493] libstdc++: Fix regression in std::format output of %Y for negative years X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 36cb7be477885a2464fe9a70467278c7debd5e79 X-Git-Newrev: ad537ccd525fd3af759febd6c0936f82de808a70 Message-Id: <20231213123034.A277B3858D39@sourceware.org> Date: Wed, 13 Dec 2023 12:30:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:ad537ccd525fd3af759febd6c0936f82de808a70 commit r14-6493-gad537ccd525fd3af759febd6c0936f82de808a70 Author: Jonathan Wakely Date: Wed Dec 13 12:00:45 2023 +0000 libstdc++: Fix regression in std::format output of %Y for negative years The change in r14-6468-ga01462ae8bafa8 was only supposed to apply to %C formats, not %Y. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_M_C_y_Y): Do not round century down for %Y formats. Diff: --- libstdc++-v3/include/bits/chrono_io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index b63b8592eba..bcd76e4ab7b 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -825,7 +825,7 @@ namespace __format { __s.assign(1, _S_plus_minus[1]); // For floored division -123//100 is -2 and -100//100 is -1 - if ((__ci * 100) != __yi) + if (__conv == 'C' && (__ci * 100) != __yi) ++__ci; } if (__ci >= 100) [[unlikely]]