From: Leif Lindholm <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: edk2-devel@lists.01.org, udit.kumar@nxp.com
Subject: Re: [PATCH v2 3/3] ArmPlatformPkg/PL031RealTimeClockLib: ignore DST setting when timezone is set
Date: Thu, 9 Nov 2017 16:34:42 +0000 [thread overview]
Message-ID: <20171109163442.cdaf5mkohrsnxjfq@bivouac.eciton.net> (raw)
In-Reply-To: <20171106182038.16750-4-ard.biesheuvel@linaro.org>
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 <ard.biesheuvel@linaro.org>
Assuming I understand the above correctly, and page 259/260 in 2.7a:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> 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
>
prev parent reply other threads:[~2017-11-09 16:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 18:20 [PATCH v2 0/3] ArmPlatformPkg EmbeddedPkg: consolidate shared RTC functionality Ard Biesheuvel
2017-11-06 18:20 ` [PATCH v2 1/3] EmbeddedPkg/RealTimeClockRuntimeDxe: move common functionality into core Ard Biesheuvel
2017-11-09 16:26 ` Leif Lindholm
2017-11-09 21:23 ` Ard Biesheuvel
2017-11-06 18:20 ` [PATCH v2 2/3] ArmPlatformPkg/PL031RealTimeClockLib: remove validation and DST handling Ard Biesheuvel
2017-11-09 16:27 ` Leif Lindholm
2017-11-06 18:20 ` [PATCH v2 3/3] ArmPlatformPkg/PL031RealTimeClockLib: ignore DST setting when timezone is set Ard Biesheuvel
2017-11-09 16:34 ` Leif Lindholm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171109163442.cdaf5mkohrsnxjfq@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox