From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1944C21B00DC1 for ; Thu, 9 Nov 2017 08:30:44 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id j15so6140927wre.8 for ; Thu, 09 Nov 2017 08:34:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fOBKW/AvEM5T1IcEDKQ77CX+792F8/eQLCH8dqVaKKg=; b=SBq2KZw90g125cerVBbb4sE4Xqq9qdETlcEp5Gl9fGd5M3zqpRbmnpG4Dyx1hJ5FXp puae9vsDqIOtQGj4G9GA4lNq4xL6zfzOkTXFsd3ggGfqQgSRiWrUUvqhJrOwlwR61Vtn 7Dr2j0oN7WUy6P6O7JglZQAlMQ221vJjREioY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fOBKW/AvEM5T1IcEDKQ77CX+792F8/eQLCH8dqVaKKg=; b=Xbcw2JQAuPtIxpQfcto0r5G3GveyAiAJxnQ7Kp0ZWBd3R7OdKAkeuCX6jHn6dJ0XBl iKS67AnH7A/Xjf/zq9VLRrVx6JlcoxU5NA14V8RAXtAFRHBIxk9GYT0dNcpAPU3kBRpR 2Rz3OYjvDOC59sRK58ptwCSvDv2r17g+7IiKrd+bcyr8pP0hSPjI6P0104gD/NJhhg0w t1XfFVi3xkixgiwVri40rDuMe4kJL5EaBPbfqLEuLUDuwQaHu1LfQuzxXRq+QzBfdPdD 8B++QpmXHGVcWiUoDDvQJxrW1Cm996JxAzrMJRagSRjNYeXIINA1Kw9pVrwuUensCf5k ztSA== X-Gm-Message-State: AJaThX4Tff/6s2FS0zcq2FgoxNrh+o5naiajmlRtKPo9nxBsCQOQ5IhQ IobKZ6sYn83TDgKi9yLjI1eXPQ== X-Google-Smtp-Source: ABhQp+RRj39hVlYb3v4G1rnilxoo7O8Qzc/tmHttSPoLQFM1Jzm353P6p64ucBnRNMri2zLkXf+WbA== X-Received: by 10.223.163.216 with SMTP id m24mr907209wrb.107.1510245285457; Thu, 09 Nov 2017 08:34:45 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id r23sm3292148wrc.93.2017.11.09.08.34.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Nov 2017 08:34:44 -0800 (PST) Date: Thu, 9 Nov 2017 16:34:42 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, udit.kumar@nxp.com Message-ID: <20171109163442.cdaf5mkohrsnxjfq@bivouac.eciton.net> References: <20171106182038.16750-1-ard.biesheuvel@linaro.org> <20171106182038.16750-4-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20171106182038.16750-4-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH v2 3/3] ArmPlatformPkg/PL031RealTimeClockLib: ignore DST setting when timezone is set X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Nov 2017 16:30:45 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 06, 2017 at 06:20:38PM +0000, Ard Biesheuvel wrote: > According to the UEFI spec, the timezone setting which the platform needs > to record in addition to the actual date and time already reflects the > current DST setting. In other words, moving the clock from standard time > to daylight saving time also involves adding or subtracting 60 minutes > from the timezone setting, as well as flicking the EFI_TIME_IN_DAYLIGHT > bit in the DST setting. > > This means we need to disregard the DST setting if the timezone is > specified, and only add or subtract the additional hour if we are on > local time. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel Assuming I understand the above correctly, and page 259/260 in 2.7a: Reviewed-by: Leif Lindholm > --- > ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c > index f1eb0deb3249..459dcc0a0519 100644 > --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c > +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c > @@ -164,12 +164,10 @@ LibGetTime ( > } > > // Adjust for the correct time zone > + // The timezone setting also reflects the DST setting of the clock > if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { > EpochSeconds += Time->TimeZone * SEC_PER_MIN; > - } > - > - // Adjust for the correct period > - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { > + } else if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { > // Convert to adjusted time, i.e. spring forwards one hour > EpochSeconds += SEC_PER_HOUR; > } > @@ -229,12 +227,10 @@ LibSetTime ( > EpochSeconds = EfiTimeToEpoch (Time); > > // Adjust for the correct time zone, i.e. convert to UTC time zone > + // The timezone setting also reflects the DST setting of the clock > if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) { > EpochSeconds -= Time->TimeZone * SEC_PER_MIN; > - } > - > - // Adjust for the correct period > - if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { > + } else if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) { > // Convert to un-adjusted time, i.e. fall back one hour > EpochSeconds -= SEC_PER_HOUR; > } > -- > 2.11.0 >