From patchwork Mon Dec 17 22:04:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 1014777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-98420-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="lN9qGvJ+"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JZvN3wgZz9s3Z for ; Tue, 18 Dec 2018 09:04:48 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=XrVDP7rzesRHSFl/zEvnqOMFLHe3na0 xTpFHmo+yqbhVs/QzfiUMzwEhpTXkw67CAYRwtz2X2Tc05KOiJNqBZaYdSf4wh9K TH4bpGGhn6jDCv93w8/11y8Oiy8iWEgVIukYG1SKPE8/D3gQ4BsoQoHaBqchxtFu TpYe00KOFh84= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=HGHxxwxK4PHrPtHBHKK/JlkTwbQ=; b=lN9qG vJ+F2fcre4FP+62vb8tK+pDhXl9GLZ95QZ7sxTU9DY1ItZAD3jF3bj5qS0ksNcs2 skfQBvH3f8RvuTyZeygbVEE66UXni4zObaAE2FXlOG4AidLf8m+aUoArO2wGv74I KONCiH9PcuUFD8l5TJZimuhsx4lgin6enicV9Q= Received: (qmail 32380 invoked by alias); 17 Dec 2018 22:04:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 32358 invoked by uid 89); 17 Dec 2018 22:04:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=2510, H*r:4d2, H*r:212.27.42, __localtime64 X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Subject: [PATCH 1/5] Y2038: add function __localtime64_r Date: Mon, 17 Dec 2018 23:04:25 +0100 Message-Id: <20181217220429.4599-2-albert.aribaud@3adev.fr> In-Reply-To: <20181217220429.4599-1-albert.aribaud@3adev.fr> References: <20181217220429.4599-1-albert.aribaud@3adev.fr> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__localtime64_r): Add. * time/localtime.c (__localtime64_r): Add. [__TIMESIZE != 64] (__localtime_r): Turn into a wrapper. --- include/time.h | 7 +++++++ time/localtime.c | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/time.h b/include/time.h index 3bc303a36e..34368295a9 100644 --- a/include/time.h +++ b/include/time.h @@ -67,6 +67,13 @@ libc_hidden_proto (__localtime64) extern struct tm *__localtime_r (const time_t *__timer, struct tm *__tp) attribute_hidden; +#if __TIMESIZE == 64 +# define __localtime64_r __localtime_r +#else +extern struct tm *__localtime64_r (const __time64_t *__timer, + struct tm *__tp) attribute_hidden; +#endif + extern struct tm *__gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp); libc_hidden_proto (__gmtime_r) diff --git a/time/localtime.c b/time/localtime.c index 96879d4ec0..37169234c8 100644 --- a/time/localtime.c +++ b/time/localtime.c @@ -25,10 +25,24 @@ struct tm _tmbuf; /* Return the `struct tm' representation of *T in local time, using *TP to store the result. */ struct tm * -__localtime_r (const time_t *t, struct tm *tp) +__localtime64_r (const __time64_t *t, struct tm *tp) { return __tz_convert (*t, 1, tp); } + +/* Provide a 32-bit variant if needed */ + +#if __TIMESIZE != 64 + +struct tm * +__localtime_r (const time_t *t, struct tm *tp) +{ + __time64_t t64 = *t; + return __localtime64_r (&t64, tp); +} + +#endif + weak_alias (__localtime_r, localtime_r) From patchwork Mon Dec 17 22:04:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 1014778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-98421-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="ZR15tjOt"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JZvY0GHQz9s7W for ; Tue, 18 Dec 2018 09:04:56 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=EFZVW2gP+mLbqoneFjkAI287koHyfTT nPWs3/YWmPpsihtQoOaIHvGQbkmjxCKOPvL2VF5QEhzR7nz4Q7ocx/s7TWYkPHhT 0nPkSZ/cMHjfP4DNRGKbT3mFCL2xOXgWFtUk4YaBoSaokOud/xa4s3+6om9K4hWR i+gw9rCifEEg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=m82e4qA3DqmThMmHANWz2ftsp70=; b=ZR15t jOtqoiohh9T/PONMDc1XusRVUrksBNtxRI3ChOlIDnfUYv6IfTU6sFRGUgr2bRi4 RrZKnDnReWqHOANJ2UmFtAO70v4xAui//xAiNR+BwSJllHm8rxTiCQFOgz+hGPls a8z/5Y83Car166IregMDtukT+Nd5ooZW6eT6wE= Received: (qmail 32673 invoked by alias); 17 Dec 2018 22:04:36 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 32555 invoked by uid 89); 17 Dec 2018 22:04:35 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=east, Hx-languages-length:1554, sec X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Subject: [PATCH 2/5] Y2038: add function __gmtime64 Date: Mon, 17 Dec 2018 23:04:26 +0100 Message-Id: <20181217220429.4599-3-albert.aribaud@3adev.fr> In-Reply-To: <20181217220429.4599-1-albert.aribaud@3adev.fr> References: <20181217220429.4599-1-albert.aribaud@3adev.fr> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__gmtime64): Add. * time/gmtime.c (__gmtime64): Add. [__TIMESIZE != 64] (__gmtime): Turn into a wrapper. --- include/time.h | 4 ++++ time/gmtime.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/time.h b/include/time.h index 34368295a9..553bf74828 100644 --- a/include/time.h +++ b/include/time.h @@ -78,6 +78,10 @@ extern struct tm *__gmtime_r (const time_t *__restrict __timer, struct tm *__restrict __tp); libc_hidden_proto (__gmtime_r) +#if __TIMESIZE == 64 +# define __gmtime64 gmtime +#endif + /* Compute the `struct tm' representation of T, offset OFFSET seconds east of UTC, and store year, yday, mon, mday, wday, hour, min, sec into *TP. diff --git a/time/gmtime.c b/time/gmtime.c index bda09bc021..67fdc89296 100644 --- a/time/gmtime.c +++ b/time/gmtime.c @@ -25,13 +25,26 @@ __gmtime_r (const time_t *t, struct tm *tp) { return __tz_convert (*t, 0, tp); } + libc_hidden_def (__gmtime_r) weak_alias (__gmtime_r, gmtime_r) +/* Return the `struct tm' representation of *T in UTC. */ +struct tm * +__gmtime64 (const __time64_t *t) +{ + return __tz_convert (*t, 0, &_tmbuf); +} + +/* Provide a 32-bit variant if needed */ + +#if __TIMESIZE != 64 -/* Return the `struct tm' representation of *T in UTC. */ struct tm * gmtime (const time_t *t) { - return __tz_convert (*t, 0, &_tmbuf); + __time64_t t64 = *t; + return __gmtime64 (&t64, 0, &_tmbuf); } + +#endif From patchwork Mon Dec 17 22:04:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 1014779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-98422-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="PnS86GIk"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JZvj6dDgz9s3Z for ; Tue, 18 Dec 2018 09:05:05 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=f/O/FYKPY4M7W2rw8x46FyA9nAQ73VL ZH8CvDfIi/UB/3RpgUOKqgrzXbTa1TzYvm6xTYMKFAgIFHGFHZ/kKRXhfm9iTKk9 9+fHWB7VQTwn0wufIQJc6ydHgqTEt4EYT9kyCC1l0GMIzMwCuntH3tm6wgvXpYVs E4HZitep+IsU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=MXmApks8Bu/9MqBE/4bzIgyK4Rg=; b=PnS86 GIkd/RYAqYizRQg7ytkz+liucc45e7mzWSAUJDUWFbW+aV3X+55H4eDnbbfaMwzA juCaLCCyodSAChqSYaszV+UEmaj18rSzym/1tcHqf4vXI5EwD5pFuge4zX0j0rSw ohbUL22VaFYhS4Q6XmJrR+iuOY6hOcMIvlREFo= Received: (qmail 32878 invoked by alias); 17 Dec 2018 22:04:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 32731 invoked by uid 89); 17 Dec 2018 22:04:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=east, sec X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Subject: [PATCH 3/5] Y2038: add function __gmtime64_r Date: Mon, 17 Dec 2018 23:04:27 +0100 Message-Id: <20181217220429.4599-4-albert.aribaud@3adev.fr> In-Reply-To: <20181217220429.4599-1-albert.aribaud@3adev.fr> References: <20181217220429.4599-1-albert.aribaud@3adev.fr> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__gmtime64_r): Add. * time/gmtime.c (__gmtime64_r): Add. [__TIMESIZE != 64] (__gmtime): Turn into a wrapper. --- include/time.h | 7 +++++++ time/gmtime.c | 15 ++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/include/time.h b/include/time.h index 553bf74828..80543e3673 100644 --- a/include/time.h +++ b/include/time.h @@ -82,6 +82,13 @@ libc_hidden_proto (__gmtime_r) # define __gmtime64 gmtime #endif +#if __TIMESIZE == 64 +# define __gmtime64_r __gmtime_r +#else +extern struct tm *__gmtime64_r (const __time64_t *__restrict __timer, + struct tm *__restrict __tp); +#endif + /* Compute the `struct tm' representation of T, offset OFFSET seconds east of UTC, and store year, yday, mon, mday, wday, hour, min, sec into *TP. diff --git a/time/gmtime.c b/time/gmtime.c index 67fdc89296..0b454d4b2b 100644 --- a/time/gmtime.c +++ b/time/gmtime.c @@ -21,11 +21,24 @@ /* Return the `struct tm' representation of *T in UTC, using *TP to store the result. */ struct tm * -__gmtime_r (const time_t *t, struct tm *tp) +__gmtime64_r (const __time64_t *t, struct tm *tp) { return __tz_convert (*t, 0, tp); } +/* Provide a 32-bit variant if needed */ + +#if __TIMESIZE != 64 + +struct tm * +__gmtime_r (const time_t *t, struct tm *tp) +{ + __time64_t t64 = *t; + return __gmtime64_r (&t64, 0, tp); +} + +#endif + libc_hidden_def (__gmtime_r) weak_alias (__gmtime_r, gmtime_r) From patchwork Mon Dec 17 22:04:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 1014780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-98423-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="NcioAYCo"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JZvt1lqSz9s7W for ; Tue, 18 Dec 2018 09:05:14 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=OLZT5xkJNoUcOogkgJ61/GA8TE333hx /N3JjneanQUWw7P2CeJz+6qui9NMUJozWZAojHxRf+BkFGrli/LUSGTC0Ydtdwwn qb8R5Cqe6eGn09nBpfMSCUQM/nGK28cwYhwZDx4DUKxiZgOyATtLgmMQlC2AjEN4 PK04pGou9wj0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=EGvsyFOwD7YFoAtPCHwmPnWL2yY=; b=NcioA YCov7zeKQIqMqcwFiKO4hww172vW7KzGUAvLOVM5vcLdKekyA+QZdS1i25AS0HQ/ E84UH9O1ARUDRzd9tD8oMe6SU0p8iMFs1cZW1kLZ520b/MvQyyXpgturbEVFI2zM vGRqMegaw+Dff27Rn9f8dZ9MlWIhGvi3/aCTQw= Received: (qmail 33115 invoked by alias); 17 Dec 2018 22:04:39 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 32959 invoked by uid 89); 17 Dec 2018 22:04:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-languages-length:1463 X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Subject: [PATCH 4/5] Y2038: add function __ctime64 Date: Mon, 17 Dec 2018 23:04:28 +0100 Message-Id: <20181217220429.4599-5-albert.aribaud@3adev.fr> In-Reply-To: <20181217220429.4599-1-albert.aribaud@3adev.fr> References: <20181217220429.4599-1-albert.aribaud@3adev.fr> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__ctime64): Add. * time/gmtime.c (__ctime64): Add. [__TIMESIZE != 64] (ctime): Turn into a wrapper. --- include/time.h | 6 ++++++ time/ctime.c | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/time.h b/include/time.h index 80543e3673..dce17b1a71 100644 --- a/include/time.h +++ b/include/time.h @@ -57,6 +57,12 @@ extern time_t __mktime_internal (struct tm *__tp, struct tm *), long int *__offset) attribute_hidden; +#if __TIMESIZE == 64 +# define __ctime64 ctime +#else +extern char *__ctime64 (const __time64_t *__timer) __THROW; +#endif + #if __TIMESIZE == 64 # define __localtime64 localtime #else diff --git a/time/ctime.c b/time/ctime.c index 1222614f29..9c51430a37 100644 --- a/time/ctime.c +++ b/time/ctime.c @@ -20,9 +20,22 @@ /* Return a string as returned by asctime which is the representation of *T in that form. */ char * -ctime (const time_t *t) +__ctime64 (const __time64_t *t) { /* The C Standard says ctime (t) is equivalent to asctime (localtime (t)). In particular, ctime and asctime must yield the same pointer. */ - return asctime (localtime (t)); + return asctime (__localtime64 (t)); } + +/* Provide a 32-bit variant if needed */ + +#if __TIMESIZE != 64 + +char * +ctime (const time_t *t) +{ + __time64_t t64 = *t; + return __ctime64 (&t64); +} + +#endif From patchwork Mon Dec 17 22:04:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 1014782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-98424-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="C77srYba"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JZw2627Pz9s8J for ; Tue, 18 Dec 2018 09:05:22 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=NwR6VYrDuyebCowIkQ+pUE+E1OfrpeC GguZHmQLQYGIBXr9pL/ufKifiNyWZSieRcK6hXcIDPmVSh5AOH0l5ObAQxj32ZSM vZM6uNPx/FyIANPStWIp4Y4bOdbxfKhbsu9EbuAL7e2MtAuOwVByx165s4jqpYVD lFTVY4JqtYZ4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=Jx8ZAaCIBj8JGyzv8H57tBgdbjY=; b=C77sr YbaKytT3KAHG7/WfeB2Q+uejBJiRtiWZukDZuQVA9dksTU+/jiRzSj6peLl/8/+f 9jBhWMU0DkGYK4UH/VAsEZFieypT30BgPmHzHld80UBzUi5CPZUxPlCeLrMlAzgV huHTsDUb2UTnQEAvNHsS55RzD/lt+rCda5rdS8= Received: (qmail 33285 invoked by alias); 17 Dec 2018 22:04:40 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 33127 invoked by uid 89); 17 Dec 2018 22:04:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy= X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Subject: [PATCH 5/5] Y2038: add function __ctime64_r Date: Mon, 17 Dec 2018 23:04:29 +0100 Message-Id: <20181217220429.4599-6-albert.aribaud@3adev.fr> In-Reply-To: <20181217220429.4599-1-albert.aribaud@3adev.fr> References: <20181217220429.4599-1-albert.aribaud@3adev.fr> Tested with 'make check' on x86_64-linux-gnu and i686-linux.gnu. * include/time.h (__ctime64_r): Add. * time/ctime_r.c (__ctime64_r): Add. [__TIMESIZE != 64] (__ctime_r): Turn into a wrapper. --- include/time.h | 7 +++++++ time/ctime_r.c | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/include/time.h b/include/time.h index dce17b1a71..5aa00cb7fa 100644 --- a/include/time.h +++ b/include/time.h @@ -63,6 +63,13 @@ extern time_t __mktime_internal (struct tm *__tp, extern char *__ctime64 (const __time64_t *__timer) __THROW; #endif +#if __TIMESIZE == 64 +# define __ctime64_r ctime_r +#else +extern char *__ctime64_r (const __time64_t *__restrict __timer, + char *__restrict __buf) __THROW; +#endif + #if __TIMESIZE == 64 # define __localtime64 localtime #else diff --git a/time/ctime_r.c b/time/ctime_r.c index c111146d76..0041fbf312 100644 --- a/time/ctime_r.c +++ b/time/ctime_r.c @@ -22,8 +22,21 @@ /* Return a string as returned by asctime which is the representation of *T in that form. Reentrant version. */ char * -ctime_r (const time_t *t, char *buf) +__ctime64_r (const __time64_t *t, char *buf) { struct tm tm; - return __asctime_r (__localtime_r (t, &tm), buf); + return __asctime_r (__localtime64_r (t, &tm), buf); } + +/* Provide a 32-bit variant if needed */ + +#if __TIMESIZE != 64 + +char * +ctime_r (const time_t *t, char *buf) +{ + __time64_t t64 = *t; + return __ctime64_r (&t64, buf); +} + +#endif