From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 23 May 2024 13:53:05 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sA70L-00F7Bq-2V for lore@lore.pengutronix.de; Thu, 23 May 2024 13:53:05 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1sA70L-0006Tj-3J; Thu, 23 May 2024 13:53:05 +0200 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.163]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sA702-0006Ta-IL for ptxdist@pengutronix.de; Thu, 23 May 2024 13:52:47 +0200 ARC-Seal: i=1; a=rsa-sha256; t=1716465165; cv=none; d=strato.com; s=strato-dkim-0002; b=fzo0jmWKZj/yPz27u9SNLNLqSBtkzTAa75UpLz0pY/eC5MiNiPAazxsq7BzhsyQDv4 BMR2iESYrrDULFNfA3x1+0wFx0DUmJFF22UVjY/AQbArrBHsZPdes9tulkfj1H2vlg5h a2dtYqd2yP7KunHyS3dfZCNK0Z4sdyWaMLvaLtScP9TQhzwhh3IyPTnzhlypvCYWTYB/ sBFFp8WzsVbdvFZ03njYxUcQ1dWZ71Uyzorp5xLS3m7VSNRhG58F9aZFx0qwlDuFRTr5 RDnjJ/YIETDKjnDjB2g58CfgimnfDMJ2FujcvMg2+l92313cJnRg1bRq1W/KZF4iLqed Ow1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1716465165; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:From:References:To:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=95z0D/sz8m6fYFydcDl/lni/uXpUanPDlP0J55+vJoM=; b=C091VsPf0hi82IMIVuNoeKu4Vf5NuT9uKfoHkQQyRxCERnwnYlfrymK7Ao4xxEcQg7 xWVgoZYAIXZz12u7kS7a5zLwjhvtDhcW7RpMXa5b/FLqSPRsixT3Q7Ru+iQAvnbTdohr EsbcRkdP1BgmcuwKmYUNpv9Cgk+X0twVbRB5I7gO3U1bA+XcCQRGdMX+EReOk1qRBhc8 EF8SpWKItUcEUlG1NhWWzsl+xN3bYacYPuoWt9a+OeO+mOKsVSMPYz8whEVDoeNLKodO qwus841AgX5JfkUJoBJLEwwBNeZec747sA93cMX9WP7LX6jc79GbB98+vtdO2Nl6WnKX ZM/g== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1716465165; s=strato-dkim-0002; d=erwinrol.com; h=In-Reply-To:From:References:To:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=95z0D/sz8m6fYFydcDl/lni/uXpUanPDlP0J55+vJoM=; b=jIH07xJ0miA2xM69cNclt/JK7qiJNIxhty5xIH4oAmuJn6osBZx2erI7okkUBp2sFa ZotL73DS8VBOYwfkACoRpSJ+e+S8LWO497FpgGFEBjhXf+fsBBhPlCkk/kdOvuYJm//l 9cdAwl4monj7nc5GILVCmlCr0wQ11/VCUYrXI86F+ixWtcMVq05T24pw/iRhf901ySPB cRWiCjcs8ch+oi4rShOUqLB5YepTvDudyewvnG0D4xJVzfm3XbyT/coWTT9fASnsJ2x+ oMGLaC3ikVjthx3bXzIK8+Gsnn/6ThiweRZQpUIdCGclgpSO5uYO5+GgI2xNPU7VYGBq LKuQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1716465165; s=strato-dkim-0003; d=erwinrol.com; h=In-Reply-To:From:References:To:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=95z0D/sz8m6fYFydcDl/lni/uXpUanPDlP0J55+vJoM=; b=UWdfIHkwkaWZ6041fYrZ31A3WOan5SlSvCCLU4TGcsHud2PCyuQyA6gT8S/JdVVdaW FdduV5VfR+oaQlm8UDBg== X-RZG-AUTH: ":IW0NeUmmfPMLa6/h5H5SuRJPHbcbCVKNPAiWvE9c+VT2q3W9psWmf2XwhOj/G5GB3zfMUpIfZgN3" Received: from [192.168.1.15] by smtp.strato.com (RZmta 50.5.0 DYNA|AUTH) with ESMTPSA id Vcdcba04NBqjvza (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Thu, 23 May 2024 13:52:45 +0200 (CEST) Message-ID: Date: Thu, 23 May 2024 13:52:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ptxdist@pengutronix.de References: <24f03e42-a9ab-4303-9d0e-3b1ff24e0097@erwinrol.com> Content-Language: en-US From: Erwin Rol In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-1.6 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] year 2038 Toolchain X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false On 5/23/24 12:38, Ian Abbott wrote: > On 23/05/2024 07:41, Erwin Rol wrote: >> The following code; >> >> auto t = std::chrono::system_clock::now(); >> >> does not seem to work correctly. When the system date is less than >> 2038 it works and gives back the correct time, but for dates > 2038 it >> seems to return some 1970 date. >> > > I guess that libstdc++ in the toolchain would need to be rebuilt with > 64-bit time_t support.  Although uses a 64-bit integer type > internally, some of the functions such as > std::chrono::system_clock::now() use compiled in code that picks up the > C system time ABI at the time libstdc++ was built.  So now() will read > the system time using the 32-bit system time ABI (so will suffer from > Y2038 problems) and convert it to its own internal 64-bit integer type. > Other functions such as > std::chrono::system_clock::from_time_t(std::time_t) are not compiled in > so will use whatever C system time ABI was selected when was > included. > I believe libstd++ uses gettimeofday internally, which should use time_t for the seconds field, which should be 64bit if _TIME_BITS=64 is defined. I just hacked the Toolchain to try it, but it is a slow process, build toolchain -> build project -> test :-) If I figure it out I'll let you guys know (so it can be added to the official Toolchain) - Erwin