From patchwork Tue Oct 27 19:29:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 40899 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0FA739540E0; Tue, 27 Oct 2020 19:30:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0FA739540E0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1603827007; bh=kuk4AxEVI1FhOVdbB0qedN7Cm3YTvMYXHtWKP452ok0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UPqvcEGo1Df34JrhiNijOJhMIBZ6d34XrzuxFPae5SFSUfOQy6D/WPAom4qYIzfEW kpyvDaqCG8CRtF/LVWUyTfgN7AGP361x0DNqybH5LIoyIUuFA194l8zCEd8xEvh03D iIIsMAj/vQqodVBVPRk47eecwz+OHbaR5rhTRUlk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by sourceware.org (Postfix) with ESMTPS id F295239518B3 for ; Tue, 27 Oct 2020 19:30:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F295239518B3 Received: by mail-qt1-x836.google.com with SMTP id i7so1900751qti.6 for ; Tue, 27 Oct 2020 12:30:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kuk4AxEVI1FhOVdbB0qedN7Cm3YTvMYXHtWKP452ok0=; b=XZGbJrc31Mlkpy3opLNdyDpXjopeeEpJv+WARXG/cRFW5FWRyk1QPQ6v1rGRZvSdUV iIqZCMPY2i6LU3O39IJeg/8h/fo4MPXIORGpXRHfXxAIwZMKMfQyXWXMrQ73ssh/5Ei2 6tuyvuxt0snI+Rxn6kIA+XBWsp+fzJb4SNuDLjqkf8OEmAu6lSJ8UeBkpGelIuZ887XI 6QqjCyzGpR7kv75M/lu0BSy7ChvVStD+c2sDJS5S1WJCaMc0PJl6RzgKwhVdm8zB5rLt Ys/OefZyD85E3lBsQu549+fQ0Qr3mO/nmOMAE6GvY0oYvsWxuFwDX0mauOCvVlFjbk3s uSiA== X-Gm-Message-State: AOAM533nu3K/0RDqo8HNqLTAcetRDP1auakynRMK2DsEGWxJHvgCvh16 xjKIvDiwzsbY2AknFbWHELlghI9FjxCvog== X-Google-Smtp-Source: ABdhPJyy7QQLiHWPZ1fYRVamZYjC99IKs334Xax50rgmls+M1yIPgxMJOD1ZRSkBkPjIYC0Ii7rHkg== X-Received: by 2002:a05:622a:1d4:: with SMTP id t20mr3805081qtw.173.1603827004263; Tue, 27 Oct 2020 12:30:04 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id 66sm1354665qkh.3.2020.10.27.12.30.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 12:30:03 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [COMMITTED] Hurd: Fix ftime build Date: Tue, 27 Oct 2020 16:29:59 -0300 Message-Id: <20201027192959.4178710-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It does not provide __clock_gettime64, the ftime y2038 support is moved to a Linux specific implementation. Checked with a build for i686-linux-gnu and on x86_64-linux and i686-linux-gnu. --- sysdeps/unix/sysv/linux/ftime.c | 54 +++++++++++++++++++++++++++++++++ time/ftime.c | 29 +++--------------- 2 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/ftime.c diff --git a/sysdeps/unix/sysv/linux/ftime.c b/sysdeps/unix/sysv/linux/ftime.c new file mode 100644 index 0000000000..1755fcf967 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ftime.c @@ -0,0 +1,54 @@ +/* Deprecated return date and time. Linux version. + Copyright (C) 1994-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +int +__ftime64 (struct __timeb64 *timebuf) +{ + struct __timespec64 ts; + __clock_gettime64 (CLOCK_REALTIME, &ts); + + timebuf->time = ts.tv_sec; + timebuf->millitm = ts.tv_nsec / 1000000; + timebuf->timezone = 0; + timebuf->dstflag = 0; + return 0; +} +#if __TIMESIZE != 64 +libc_hidden_def (__ftime64) + +int +ftime (struct timeb *timebuf) +{ + struct __timeb64 tb64; + __ftime64 (&tb64); + if (! in_time_t_range (tb64.time)) + { + __set_errno (EOVERFLOW); + return -1; + } + timebuf->time = tb64.time; + timebuf->millitm = tb64.millitm; + timebuf->timezone = tb64.timezone; + timebuf->dstflag = tb64.dstflag; + return 0; +} +#endif diff --git a/time/ftime.c b/time/ftime.c index 91ba100503..93f485bbf7 100644 --- a/time/ftime.c +++ b/time/ftime.c @@ -16,15 +16,14 @@ License along with the GNU C Library; if not, see . */ -#include #include -#include +#include int -__ftime64 (struct __timeb64 *timebuf) +ftime (struct timeb *timebuf) { - struct __timespec64 ts; - __clock_gettime64 (CLOCK_REALTIME, &ts); + struct timespec ts; + __clock_gettime (CLOCK_REALTIME, &ts); timebuf->time = ts.tv_sec; timebuf->millitm = ts.tv_nsec / 1000000; @@ -32,23 +31,3 @@ __ftime64 (struct __timeb64 *timebuf) timebuf->dstflag = 0; return 0; } -#if __TIMESIZE != 64 -libc_hidden_def (__ftime64) - -int -ftime (struct timeb *timebuf) -{ - struct __timeb64 tb64; - __ftime64 (&tb64); - if (! in_time_t_range (tb64.time)) - { - __set_errno (EOVERFLOW); - return -1; - } - timebuf->time = tb64.time; - timebuf->millitm = tb64.millitm; - timebuf->timezone = tb64.timezone; - timebuf->dstflag = tb64.dstflag; - return 0; -} -#endif