From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id 3BD661F461 for ; Wed, 28 Aug 2019 21:39:12 +0000 (UTC) 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:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=nbwgZ LNUh+po9mBo9Ff8wtF2rG8VBBHVfGViA4Rm3jneA/4qVinz0EETFnSLrQsG/0bl5 SRzrAVhKEq7HifkGO9317fodac9NbVAghh72s2e+7S7GNGdHWTL566YawemKgE/n QNT11+W+Dp+FkhFsgXH7gFK8FPf32ZBCYHCeuk= 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:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=qn4IlcHwQPD zvcjqYZu1V4pTTxk=; b=B+MoHxWUd3DF1P+rpij4/jUV3K+dsafi2R2RtIbP5K5 K056ml/nut+NqTtSl9eT1ff2peTAHhS1Lbqc9Rva7p3Y5+M/CutNYFmVmBN7RoQs tR+0nrXzPbQbl1c3UC7CY41PRsvp9a2+R5zWkFeK/H8GBtvGdO1pBL+HjIcNyYwM = Received: (qmail 110563 invoked by alias); 28 Aug 2019 21:39:10 -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 Received: (qmail 110543 invoked by uid 89); 28 Aug 2019 21:39:09 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.redhat.com From: Florian Weimer To: Paul Eggert Cc: Zack Weinberg , libc-alpha@sourceware.org, Joseph Myers , Lukasz Majewski , Alistair Francis , Stepan Golosunov , Arnd Bergmann , Adhemerval Zanella , Samuel Thibault Subject: Re: [PATCH v2 05/10] Use clock_gettime to implement time. References: <20190828153236.18229-1-zackw@panix.com> <20190828153236.18229-6-zackw@panix.com> <87muftb1fk.fsf@oldenburg2.str.redhat.com> <87sgpl9h2o.fsf@oldenburg2.str.redhat.com> <321d1bd0-a9f6-310b-5412-a023d813e90f@cs.ucla.edu> Date: Wed, 28 Aug 2019 23:39:01 +0200 In-Reply-To: <321d1bd0-a9f6-310b-5412-a023d813e90f@cs.ucla.edu> (Paul Eggert's message of "Wed, 28 Aug 2019 14:12:10 -0700") Message-ID: <87imqh9dhm.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain * Paul Eggert: > Florian Weimer wrote: >> time can definitely return the >> value of a variable that is incremented periodically from the timer >> interrupt. > > Is that variable the one that CLOCK_REALTIME_COARSE uses? If so, and > if we're going to replace calls to 'time' with calls to > 'clock_realtime', we can do either of the following: > > * Use CLOCK_REALTIME_COARSE. This takes less CPU time and its behavior > better matches what the current glibc does. > > * Use CLOCK_REALTIME. This will lessen bugs due to naive code (quite > possibly some code within glibc!) which assumes that 'time (0)' and > clock_gettime (CLOCK_REALTIME, ...)' use the same clock. I think we should keep using the time entry in the vDSO. This consolidation is just not possible to do for performance reasons. > It sounds you're leaning towards (1) and I'm inclined to > agree. However, shouldn't the manual say that 'time' does not > necessarily agree with CLOCK_REALTIME? The current behavior is a trap > for the unwary. Yes, clarifying the manual would make sense. I do not know where the discrepancy comes from. It could just be that CLOCK_REALTIME performs rounding, while time performs truncation. Thanks, Florian