diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2020-12-30 18:07:48 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-01-30 14:25:42 -0700 |
commit | 43db07507abdb54b6575345300c171b0486e46be (patch) | |
tree | 7c6ba06d302c3cc443b6f7cf73bd8ff7b4ea69f7 /drivers | |
parent | 5e6c9029cdeae72eeeb4e05caa4ce3d48e2e86fb (diff) | |
download | u-boot-43db07507abdb54b6575345300c171b0486e46be.zip u-boot-43db07507abdb54b6575345300c171b0486e46be.tar.gz u-boot-43db07507abdb54b6575345300c171b0486e46be.tar.bz2 |
sandbox: keep time offset when resetting
The UEFI Self Certification Test (SCT) checks the SetTime() service with
the following steps:
* set date
* reset
* check date matches
To be compliant the sandbox should keep the offset to the host RTC during
resets. The implementation uses the environment variable
UBOOT_SB_TIME_OFFSET to persist the offset.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rtc/i2c_rtc_emul.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c index 5a2a154..f25b976 100644 --- a/drivers/rtc/i2c_rtc_emul.c +++ b/drivers/rtc/i2c_rtc_emul.c @@ -57,6 +57,7 @@ long sandbox_i2c_rtc_set_offset(struct udevice *dev, bool use_system_time, plat->use_system_time = use_system_time; if (offset != -1) plat->offset = offset; + os_set_time_offset(plat->offset); return old_offset; } @@ -80,7 +81,7 @@ static void reset_time(struct udevice *dev) os_localtime(&now); plat->base_time = rtc_mktime(&now); - plat->offset = 0; + plat->offset = os_get_time_offset(); plat->use_system_time = true; } @@ -115,6 +116,7 @@ static int sandbox_i2c_rtc_set(struct udevice *dev, const struct rtc_time *time) now = plat->base_time; } plat->offset = rtc_mktime(time) - now; + os_set_time_offset(plat->offset); return 0; } |