From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 24 May 2024 10:41:54 +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 1sAQUs-00GR9P-0m for lore@lore.pengutronix.de; Fri, 24 May 2024 10:41:54 +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 1sAQUr-0001qF-P6; Fri, 24 May 2024 10:41:53 +0200 Received: from smtp79.iad3b.emailsrvr.com ([146.20.161.79]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sAQUX-0001pr-4P for ptxdist@pengutronix.de; Fri, 24 May 2024 10:41:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1716540091; bh=i32vWDY/9wKZ0hjFroPE/1+eKploToODrhxy70ZKboE=; h=Date:Subject:To:From:From; b=RqcNq1uMTiQ82qwIRCvdbZDLgLPpk/Uc0AMqxXIvjZs2LpT7Hzz11fbp/6B0Z2s8B I8jBeXBGX8pb6tqAO+GEabBhu0MKOZ7Op9sbVVVQ0iSv/nwfqwed2454BAMxPHm2ec EIl35+83lPJ8WvRzaMpRvqqMnrxscbdvLwx9m+Qc= X-Auth-ID: abbotti@mev.co.uk Received: by smtp18.relay.iad3b.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 5A98DE01B5 for ; Fri, 24 May 2024 04:41:31 -0400 (EDT) Message-ID: Date: Fri, 24 May 2024 09:41:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ptxdist@pengutronix.de References: <24f03e42-a9ab-4303-9d0e-3b1ff24e0097@erwinrol.com> Content-Language: en-GB From: Ian Abbott Organization: MEV Ltd. In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Classification-ID: 130ba174-9425-4623-9956-6f4f012fb585-1-1 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=-3.6 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,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 23/05/2024 12:52, Erwin Rol wrote: > 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) Rememember to define _FILE_OFFSET_BITS=64 too if it is not already defined. _TIME_BITS=64 is ineffective when _FILE_OFFSET_BITS=32 for Glibc policy reasons. -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-