From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 34CD73858D3C for ; Mon, 22 Jan 2024 13:48:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34CD73858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 34CD73858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705931327; cv=none; b=BaMyaapXL90qAuzQ2i3Cf5oEdRuSKYwBVH2VQvDVDb45Cb9TcwT3PkbZsv2lnrND2e5WdTnZiAMGuxYw8dRSOE1MiBMZw/zmAeZYGuM4c0mQd2PCP73VgI+H4TyPXB6yAKAtdyR367/YqS+YI+KTMhBb483BKBoMdPmDAdzmZxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705931327; c=relaxed/simple; bh=YvgDoIvgei4TtXEp4lY2X9MYHH7wPH9yvhc4sJDQj/A=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=IpXYhqxfAAIcO33ZPCNkloshdsQ4QyASZGiGKWgc6VQcSdpknPZJvorFgd5Nb2E+oJGsYO6lqKV93/jTolNCOavPnDVTBU0j4UBQXFSRtGxBjKlxCbV/E5QOU12na4FDFuZ7cZeJ4P6mYUHpqQ2ulKux57U2kQos70F5gS+ahog= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705931323; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z4wQwOv6gS3i9Koj/CeRiyfX1iIDeECwtKRcM+6mLkg=; b=IlEEYF2/8ufWLGpWSiJkv30u3qP3U77k4PBou6oU4bpMX7yBz1MiDRpx/GTdziYf2ig3jw V42o2ZBScbtQ5B9xRs74xfLmkP66NLBMs7VeD2Lg3rZxpluX2INUmCSyfO/lu90rRVs7lA p8tLGNWALh1kXA2vIxcNAMK/grJMmkQ= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-qNTPYTYAMiWXM-1dkBxdaA-1; Mon, 22 Jan 2024 08:48:42 -0500 X-MC-Unique: qNTPYTYAMiWXM-1dkBxdaA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-5f325796097so52563727b3.1 for ; Mon, 22 Jan 2024 05:48:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705931321; x=1706536121; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Z4wQwOv6gS3i9Koj/CeRiyfX1iIDeECwtKRcM+6mLkg=; b=HO/OccuKGHbbC300x+BOokwfRAt75a8PBurLOpNPdl4S10S1uAloHuRHPaRPiPY5AN rR3oCf99u0ZPPHhfX5O+V++N5FZlZuqqcj8c/IMpvCb8N/+Ev+FO3ktIQ5nImETZsQ/P Q5n+Ae4V6fyRq1SoaklHPz3XEc89tnW4MrtO4EJnoyCV4lKs6XRcGZhnrwLgt1eApKZs WJvgvRxDBJBPWh0j7LASyMkXELYBDEvboi5TvMMZPYtV0/usfluvBdb0x31SdL6x/Nnv 6i9Jq8iPkLeSUF91egtsyAS3InMWVxNwVhLvtQhR8ph39tEOUYaoapOCOKUBjNCNx7Y8 f8AQ== X-Gm-Message-State: AOJu0YzHuhF5tNotoUWU0bT+zd4ZFqiIfBafqS93A3Cmcm+Ud7QG7310 ayn1un9IUaO6C37kQCASLbOUYIRM5+Xjxbfbd9B4ih/F53oQbYEYzj47H1xICAJUw5pXIzXwpgN H9UCgGNBOTPe+lLp+NxKHVBx3LKLM2+hy6Ql1RKlklxFIDhij4Oziu5v/h1n4feqWz1XMGrdFoL iFZ2rC2JK/fRzNDAcGV0L9pzW80ptxpNhMs2qaU3W9 X-Received: by 2002:a81:fd06:0:b0:5ff:ac45:eba7 with SMTP id g6-20020a81fd06000000b005ffac45eba7mr1721870ywn.103.1705931321759; Mon, 22 Jan 2024 05:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJwPZ5ydRMsyakewPK57XsiOZD0hIpk8LY8+jzszwwaA+nhj548WGkaFiORnt4x299dZ6+B3z5+0Rskto5UsA= X-Received: by 2002:a81:fd06:0:b0:5ff:ac45:eba7 with SMTP id g6-20020a81fd06000000b005ffac45eba7mr1721864ywn.103.1705931321544; Mon, 22 Jan 2024 05:48:41 -0800 (PST) MIME-Version: 1.0 References: <20240121222701.452264-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Mon, 22 Jan 2024 13:48:25 +0000 Message-ID: Subject: Re: [committed] libstdc++: Fix std::format for floating-point chrono::time_point [PR113500] To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 22 Jan 2024 at 09:51, Jonathan Wakely wrote: > > On Sun, 21 Jan 2024 at 22:27, Jonathan Wakely wrote: > > --- a/libstdc++-v3/testsuite/std/time/clock/file/io.cc > > +++ b/libstdc++-v3/testsuite/std/time/clock/file/io.cc > > @@ -17,6 +17,23 @@ test_ostream() > > VERIFY( ss1.str() == ss2.str() ); > > } > > > > +void > > +test_format() > > +{ > > + using namespace std::chrono; > > + auto t = file_clock::now(); > > + > > + auto s = std::format("{}", t); > > + std::ostringstream ss; > > + ss << t; > > + VERIFY( s == ss.str() ); > > + > > + // PR libstdc++/113500 > > + auto ft = clock_cast(sys_days(2024y/January/21)) + 0ms + 2.5s; > > + s = std::format("{}", ft); > > + VERIFY( s == "2024-01-17 00:00:02.500"); > > Well obviously that should be 2024-01-21 and I should add a call to > test_format() in main() so it actually runs. And I did the same in the gps/io.cc test! I'll push this fix for that one: --- a/libstdc++-v3/testsuite/std/time/clock/gps/io.cc +++ b/libstdc++-v3/testsuite/std/time/clock/gps/io.cc @@ -42,7 +42,7 @@ test_format() // PR libstdc++/113500 s = std::format("{}", gt + 150ms + 10.5s); - VERIFY( s == "2000-01-01 00:00:35.650" ); + VERIFY( s == "2000-01-01 00:00:23.650" ); } void @@ -65,5 +65,6 @@ test_parse() int main() { test_ostream(); + test_format(); test_parse(); }