From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60193 invoked by alias); 11 Sep 2017 07:06:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 59840 invoked by uid 89); 11 Sep 2017 07:06:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: zimbra.cs.ucla.edu Subject: Re: [RFC PATCH 51/52] Y2038: add RPC functions From: Paul Eggert To: "Albert ARIBAUD (3ADEV)" , libc-alpha@sourceware.org References: <20170907224219.12483-50-albert.aribaud@3adev.fr> <20170908174909.28192-1-albert.aribaud@3adev.fr> <20170908174909.28192-2-albert.aribaud@3adev.fr> Message-ID: Date: Mon, 11 Sep 2017 07:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-SW-Source: 2017-09/txt/msg00436.txt.bz2 Paul Eggert wrote: >=20 > /* time_t is always 'long int' in the GNU C Library. */ > #define TIME_T_MIN LONG_MIN > #define TIME_T_MAX LONG_MAX >=20 > static inline bool > fits_in_time_t (__time64_t t) > { > #if 7 <=3D __GNUC__ > return !__builtin_add_overflow_p (t, 0, TIME_T_MAX); > #endif > return TIME_T_MIN <=3D t && t <=3D TIME_T_MAX; > } Marc Glisse suggested a simpler solution: static inline bool fits_in_time_t (__time64_t t) { return t =3D=3D (time64_t) t; } This is documented to work for GCC, something I had forgotten, and it gener= ates=20 better code for pre-7 GCC. See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D82170#c2