From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id INoFHqEUZGI+5QAAbAwnHQ (envelope-from ) for ; Sat, 23 Apr 2022 17:00:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id EIMNHqEUZGIyLAEA9RJhRA (envelope-from ) for ; Sat, 23 Apr 2022 17:00:49 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EA8B12D2AD for ; Sat, 23 Apr 2022 17:00:48 +0200 (CEST) Received: from localhost ([::1]:32850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niHFf-0002up-2v for larch@yhetil.org; Sat, 23 Apr 2022 11:00:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niGrr-0005qo-7O; Sat, 23 Apr 2022 10:36:11 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:54773) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niGrp-0004N0-Eg; Sat, 23 Apr 2022 10:36:10 -0400 Received: from [192.168.101.10] ([91.1.218.246]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N6szR-1nxddQ3kQJ-018NzL; Sat, 23 Apr 2022 16:35:43 +0200 Message-ID: <199c2d68-7057-ca0e-477c-645ca39f1709@bernhard-voelker.de> Date: Sat, 23 Apr 2022 16:35:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: bug#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones Content-Language: en-US To: Paul Eggert , Eli Zaretskii References: <5ed963b2-3fa8-48d8-627e-bc0571d15b43@gmail.com> <149de00f-115b-5367-414f-c7700ef8966b@cs.ucla.edu> <2dd15844-01b3-0144-740c-185ec8488a81@cs.ucla.edu> <4a23f3a4-fe8f-d396-49d8-10034803be63@gmail.com> <52fb10fb-892a-f273-3be8-28793f27e204@cs.ucla.edu> <5cd820d4-ae67-43d4-9e63-c284d51ff1e4@gmail.com> <83tuapvcxs.fsf@gnu.org> <6efc5d24-34a2-fd30-cd20-fe4ac3e48310@cs.ucla.edu> <83fsm8tdzl.fsf@gnu.org> <9e4781b2-2ffa-b1ce-09b4-ead82cad9038@cs.ucla.edu> From: Bernhard Voelker In-Reply-To: <9e4781b2-2ffa-b1ce-09b4-ead82cad9038@cs.ucla.edu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K1:69+xSR4N4PMoXfry7P3LB/qW60CsZyId3woImflk6crNTfPW97K Bi2zBJGp4pKWKbH7g+g4FSxwyOMsSGTFg3NkPWYn/aEx5hWtkcma2EJx8z8HCD3jW1vz4v5 ObVnpCfo/4AeA2aB9Pq/ZmECz3Y23uKE/qtUgLoheez47U2mEME7Kpz+JXoC9xeKt2d0jDS iJu0qA/PLeoxMaKd9+8wg== X-UI-Out-Filterresults: notjunk:1;V03:K0:mNH59tLcJXA=:MyvBe2KFfF/IkGaPIJgU34 evEd1DvbfGfEfMZMHhzuVbI0UCHfwCT01bL506SHX+kfMk/bA4/YOrTcl/gkjpR4QbwtssLby oR84Mb/yVw8ii7KHRqxKlh0eykoc6XsUrlRn6HFx3/ko/oHcexNy8Ascqzd9snD71+lWfHI+k lZkQBCeEzS3oLz+af/Myz9NWxKiFzg1bTU2DcZ+1vIWqNq6jP38i9Ug0LNeyt8uSNMfTXiU+K EHkwMIPHFdT2HIjaOhzF0Jq0z3QazGyirLZ+XRoFodr9JFkPaGr4t+4ig3f6rp00izM8d+XaS 9gId1jjk2NO81iM9LCjLWWEwzzqkgW94BODK56aUmXtaWvPfaCT6hA3vb+XkEy+vC1ON4bpLO fSdbhmkPGb8MGun2+DWya+i5gjmjr8i5scgIHrSUUlgkZ9ypRAnjADOHyzM7gQUtuvjaltwnU Jfww7aC8S2NUmxWp3IsgqaUQoBX1ErkTVyZucuXS2W7QAbJbWVQB4THkWLxu6hYLwSUfY+ucw 4pUczY9/uPhunqvj9hBF/phybG8eXw1zuztpeio7YsHVvhtTBrnu6ealcRJYNVwUYbCBKOzPJ aHCSbeiRVo8b6ld6dPQ7bnQnlhpE2wEYvxE3Koz9WtgqR6bGnf54MJurMxeRxzAyf1eg4YSvc I0PzJ2QYdxiTn0hX/8jNjx42/zmaLJRi6LAvCIOfnJz9/rlvEMZFmuzJXOsvoDd5dCPoO+BdS +48FgMjPSLeLwZ4g Received-SPF: none client-ip=212.227.17.13; envelope-from=mail@bernhard-voelker.de; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 23 Apr 2022 10:59:50 -0400 X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org, manikulin@gmail.com, Gnulib bugs , 54764@debbugs.gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650726049; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ujSKFU7NhqXU32dRbakEK61fFxUbnayPx90UKEsFk3o=; b=reecRTiop4OAlacNvp1ZxQKyAw/xGVuzPgolt/S4BoKmN2/uHOCbctROqDikWqY/ciXuvD 7Vk+JBQLVxE3LWxT3dwfK582pPmR6Y7LJZCjT6X8BhLaNGaBShccWJEC3Tz1pDOcNHlPm3 8np68tks8oy7YCxw1NIKIES8kvotK691zuhoC9pJ9Yes07pimSUnqu+Q6gd1MW83zQpBCp Q2f3/LBx4l0ADh5RgzehXGGRlmfQ5eMoOiRb9JjQ4JKWUNuYoTo5quxJLs7T/Ydxr9PQQb ZbLETGegiaN16dy1xsvNSJYai2db/nBrpvyQ5akQaTh1AWgjXHKR+1PgBoHJZw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650726049; a=rsa-sha256; cv=none; b=V0Jv1J7fV3hAvu5ZhY0mtb/7P8b0Z9NKc67wdKqLVhb8RHC+x6XGxgggUlPD3S/u908pgu jlx//35V2+ilHiW75d+UjLN6CfU6oh9r59Ke1fr8guVyYTXv++V17iMLZAhb+sLR9lt2cm mdcRQUWOuwXLnn2fhWrAENtAPRapg/EFbEdW6cSd6ycsE2+RwyU5VQKHFBGboUXDcjr6NZ gKZGWhPyvRwckmrvGbT14//B/nu43b1ThyiQ+dv5mUiRDQ4x65G65VIODhT3MhvLXqUrsV 6U4Es9kNImOErvoaqZ/EfUkHWDM9G7+4TUt1Gk7i3ZURbQDs7uvynSlmStXOCQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.82 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EA8B12D2AD X-Spam-Score: -2.82 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7zQ3V1a+O4CN On 4/20/22 20:19, Paul Eggert wrote: > diff --git a/lib/gettime-res.c b/lib/gettime-res.c > index 611f83ad27..bb4d0b191d 100644 > --- a/lib/gettime-res.c > +++ b/lib/gettime-res.c > @@ -53,6 +53,8 @@ gettime_res (void) > > long int hz = TIMESPEC_HZ; > long int r = hz * res.tv_sec + res.tv_nsec; > + struct timespec earlier; > + earlier.tv_nsec = -1; > > /* On some platforms, clock_getres (CLOCK_REALTIME, ...) yields a > too-large resolution, under the mistaken theory that it should > @@ -61,9 +63,22 @@ gettime_res (void) > resolution. Work around the problem with high probability by > trying clock_gettime several times and observing the resulting > bounds on resolution. */ > - for (int i = 0; 1 < r && i < 32; i++) > + int nsamples = 32; > + for (int i = 0; 1 < r && i < nsamples; i++) > { > - struct timespec now = current_timespec (); > + /* If successive timestamps disagree the clock resolution must > + be small, so exit the inner loop to check this sample. > + Otherwise, arrange for the outer loop to exit but continue > + the inner-loop search for a differing timestamp sample. */ > + struct timespec now; > + for (;; i = nsamples) > + { > + now = current_timespec (); > + if (earlier.tv_nsec != now.tv_nsec || earlier.tv_sec != now.tv_sec) > + break; > + } > + earlier = now; > + > r = gcd (r, now.tv_nsec ? now.tv_nsec : hz); > } lib/gettime-res.c: In function 'gettime_res': lib/gettime-res.c:77:46: error: 'earlier.tv_sec' may be used uninitialized in this function \ [-Werror=maybe-uninitialized] 77 | if (earlier.tv_nsec != now.tv_nsec || earlier.tv_sec != now.tv_sec) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We know that earlier.tv_sec is set when tv_nsec is set, but the compiler does not, obviously. Considering the nested loops, I'd say initializing tv_sec doesn't harm performance-wise. Have a nice day, Berny