From patchwork Wed Apr 18 20:17:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert ARIBAUD X-Patchwork-Id: 26790 Received: (qmail 102657 invoked by alias); 18 Apr 2018 20:19:23 -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 102555 invoked by uid 89); 18 Apr 2018 20:19:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 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_LOW, RCVD_IN_RP_RNBL autolearn=ham version=3.3.2 spammy= X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [[PATCH RFC 2] 11/63] Y2038: implement 64-bit-time __timegm64() Date: Wed, 18 Apr 2018 22:17:27 +0200 Message-Id: <20180418201819.15952-12-albert.aribaud@3adev.fr> In-Reply-To: <20180418201819.15952-11-albert.aribaud@3adev.fr> References: <20180418201819.15952-1-albert.aribaud@3adev.fr> <20180418201819.15952-2-albert.aribaud@3adev.fr> <20180418201819.15952-3-albert.aribaud@3adev.fr> <20180418201819.15952-4-albert.aribaud@3adev.fr> <20180418201819.15952-5-albert.aribaud@3adev.fr> <20180418201819.15952-6-albert.aribaud@3adev.fr> <20180418201819.15952-7-albert.aribaud@3adev.fr> <20180418201819.15952-8-albert.aribaud@3adev.fr> <20180418201819.15952-9-albert.aribaud@3adev.fr> <20180418201819.15952-10-albert.aribaud@3adev.fr> <20180418201819.15952-11-albert.aribaud@3adev.fr> Implementation is based on the same __mktime64_internal function which was introduced in the '__mktime64' implementation change. --- time/Versions | 1 + time/timegm.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/time/Versions b/time/Versions index f5ccacc759..7cfae8760c 100644 --- a/time/Versions +++ b/time/Versions @@ -71,5 +71,6 @@ libc { __gmtime64; __gmtime64_r; __localtime64; __localtime64_r; __mktime64; __timelocal64_r; + __timegm64; } } diff --git a/time/timegm.c b/time/timegm.c index fb720e2d7d..8ac9b0b78e 100644 --- a/time/timegm.c +++ b/time/timegm.c @@ -36,6 +36,9 @@ time_t __mktime_internal (struct tm *, struct tm * (*) (time_t const *, struct tm *), time_t *); +__time64_t __mktime64_internal (struct tm *, + struct tm * (*) (__time64_t const *, struct tm *), + __time64_t *); #endif time_t @@ -45,3 +48,11 @@ timegm (struct tm *tmp) tmp->tm_isdst = 0; return __mktime_internal (tmp, __gmtime_r, &gmtime_offset); } + +__time64_t +__timegm64 (struct tm *tmp) +{ + static __time64_t gmtime64_offset; + tmp->tm_isdst = 0; + return __mktime64_internal (tmp, __gmtime64_r, &gmtime64_offset); +}