From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84443C00144 for ; Mon, 1 Aug 2022 19:13:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C4AAC844FE; Mon, 1 Aug 2022 21:13:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Q+HSO/Tm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7BD184506; Mon, 1 Aug 2022 21:13:39 +0200 (CEST) Received: from mail-vk1-xa2f.google.com (mail-vk1-xa2f.google.com [IPv6:2607:f8b0:4864:20::a2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7042E8407A for ; Mon, 1 Aug 2022 21:13:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-vk1-xa2f.google.com with SMTP id b81so6053885vkf.1 for ; Mon, 01 Aug 2022 12:13:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bUFoaFs6B5z70+gy1HeNOcO85r13A9FBSPNd0dv2oao=; b=Q+HSO/TmTctnGP5zLB+ASBbJvYTc4Z8aRfrTSO00FwZ1UlUFYDouXBho5BR2Y7eAPi RzIASvxUKmDjN37bk6ZT/L9joHebGRqoYbjkRulF1T9NG2BoNu554RZc4rOJ7o00B7lF hOCqoRI/7xhrC2bFF+ORXTzAbtz7L+SFk+y+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bUFoaFs6B5z70+gy1HeNOcO85r13A9FBSPNd0dv2oao=; b=Fpug+J0NeGxF1mh4W2WoKAIQk7pySnDx/4BPfIyYF+0XPPR9iJRatenpr1IP6BiG3u ZvGuswqbljHYQpAcsCjg4YeLYo1fdOxv3y3DMWhb4y5UY4nMradRQCGRskt4m0xqlaR0 Bo9MFa8SvV1MxAMh31/lrDjagWewaH0kL82Pbz/e/3/3RRYNDM4dHBDEtmQ+uuPFjHLx fnKPqdn5vEJtgI46tnMqBdcJbOyJVUiwIP3kXivWDw1mz1xu/NXBZ/yMQ5fxzvLNIMh+ b1ZvFBm6otz6Ed0a3WJYUCs+GH2/WggYT0lV/sGLyBfKL8Yp58inz0zUJt1KT5KaJnB6 50DA== X-Gm-Message-State: AJIora/TVDqFM1mPp7/CyFxjqItnGZpMBHgj29EyzL122MqQ6TvOxj2R 6Wmguer1hRX6Rtwr42mMa+Bv9tLVMiBlJ0fSfDs/MA== X-Google-Smtp-Source: AGRyM1sS1mtTnj9kvvGvTyY/LZDP1Gjfev+EvbwexdmYYne+8JAQnCV32HDHlA+bmuMapTTr8tkTq26nuejj0f01eCo= X-Received: by 2002:ac5:c391:0:b0:36b:f530:4c1a with SMTP id s17-20020ac5c391000000b0036bf5304c1amr6736541vkk.8.1659381212957; Mon, 01 Aug 2022 12:13:32 -0700 (PDT) MIME-Version: 1.0 References: <20220801135848.992449-1-sjg@chromium.org> <20220801135848.992449-6-sjg@chromium.org> <8dc1ec38-3ec9-fa7c-3b35-290fcbb86a85@gmx.de> In-Reply-To: <8dc1ec38-3ec9-fa7c-3b35-290fcbb86a85@gmx.de> From: Simon Glass Date: Mon, 1 Aug 2022 13:13:20 -0600 Message-ID: Subject: Re: [PATCH 5/5] dm: rtc: Try to handle the localtime() race To: Heinrich Schuchardt Cc: U-Boot Mailing List , Tom Rini , Marek Vasut , Pavel Herrmann Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Mon, 1 Aug 2022 at 09:00, Heinrich Schuchardt wrote: > > On 8/1/22 15:58, Simon Glass wrote: > > At present the sandbox timer uses localtime() which can jump around twice > > a year when daylight-saving time changes. > > > > It would be tricky to make use of gmtime() since we still need to present > > the time in local time, as seems to be required by U-Boot's RTC interface. > > > > The problem can only happen once, so use a loop to detect it and try > > again. This should be sufficient to detect either a change in the 'second' > > value, or a daylight-saving change. We can assume that the latter also > > incorporates a 'second' change, so there is no need to loop more than > > twice. > > > > Signed-off-by: Simon Glass > > Linux systems tend to use UTC on the RTC. There is no reason for > sandbox_defconfig to deviate. Please, avoid all this complication by > reading the time with gmtime() instead of localtime(). That is an API change...how will we show the local time in that case? I suppose we need to add this concept to rtc.h ? Regards, Simon