All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/5] efi_loader: handling of daylight saving time
Date: Sat,  1 Jun 2019 10:58:39 +0200	[thread overview]
Message-ID: <20190601085840.2873-5-xypron.glpk@gmx.de> (raw)
In-Reply-To: <20190601085840.2873-1-xypron.glpk@gmx.de>

If SetTime() is meant to set daylight saving time it will be called with
Time.Daylight == EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT.

Return 0 from GetTime() if time is not in daylight because we cannot
determine if we are in a time zone with daylight saving time.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2
	new patch
---
 lib/efi_loader/efi_runtime.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 2082d1304f..98ab4de03d 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -195,9 +195,9 @@ static efi_status_t EFIAPI efi_get_time_boottime(
 	time->hour = tm.tm_hour;
 	time->minute = tm.tm_min;
 	time->second = tm.tm_sec;
-	time->daylight = EFI_TIME_ADJUST_DAYLIGHT;
-	if (tm.tm_isdst > 0)
-		time->daylight |= EFI_TIME_IN_DAYLIGHT;
+	if (tm.tm_isdst)
+		time->daylight =
+			EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT;
 	time->timezone = EFI_UNSPECIFIED_TIMEZONE;

 	if (capabilities) {
@@ -276,7 +276,8 @@ static efi_status_t EFIAPI efi_set_time_boottime(struct efi_time *time)
 	tm.tm_hour = time->hour;
 	tm.tm_min = time->minute;
 	tm.tm_sec = time->second;
-	tm.tm_isdst = time->daylight == EFI_TIME_IN_DAYLIGHT;
+	tm.tm_isdst = time->daylight ==
+		      (EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT);
 	/* Calculate day of week */
 	rtc_calc_weekday(&tm);

--
2.20.1

  parent reply	other threads:[~2019-06-01  8:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-01  8:58 [U-Boot] [PATCH v2 0/5] efi_loader: parameter checks in SetTime() Heinrich Schuchardt
2019-06-01  8:58 ` [U-Boot] [PATCH v2 1/5] rtc: export rtc_month_days() Heinrich Schuchardt
2019-06-01  8:58 ` [U-Boot] [PATCH v2 2/5] efi_loader: check time in SetTime() Heinrich Schuchardt
2019-06-01  8:58 ` [U-Boot] [PATCH v2 3/5] efi_loader: export efi_set_time() Heinrich Schuchardt
2019-06-01  8:58 ` Heinrich Schuchardt [this message]
2019-06-01  8:58 ` [U-Boot] [PATCH v2 5/5] efi_loader: Kconfig entries for GetTime(), SetTime() Heinrich Schuchardt

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-all 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=20190601085840.2873-5-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.