diff options
author | Tom Rini <trini@konsulko.com> | 2021-01-31 08:49:53 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-31 08:49:53 -0500 |
commit | 242ef48ea76ae13ac6357cc50aae01eb7a46bfef (patch) | |
tree | 18105866b6063eddcc7ddb0530c002fadc377b3b /arch/sandbox/cpu/os.c | |
parent | 76404f86a24aa28efc26a296bf6ab9d697c60b9f (diff) | |
parent | f84eda89e5970ef513fe64ba8e8d977788c44dca (diff) |
Merge tag 'dm-pull-30jan21' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
tpm fixes for coral
binman fixes support for symbols in sub-sections
support for additional cros_ec commands
various minor fixes / tweaks
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r-- | arch/sandbox/cpu/os.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 80996a91ce..3d8af0a52b 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -32,6 +32,9 @@ #include <os.h> #include <rtc_def.h> +/* Environment variable for time offset */ +#define ENV_TIME_OFFSET "UBOOT_SB_TIME_OFFSET" + /* Operating System Interface */ struct os_mem_hdr { @@ -798,6 +801,28 @@ int os_spl_to_uboot(const char *fname) return os_jump_to_file(fname); } +long os_get_time_offset(void) +{ + const char *offset; + + offset = getenv(ENV_TIME_OFFSET); + if (offset) + return strtol(offset, NULL, 0); + return 0; +} + +void os_set_time_offset(long offset) +{ + char buf[21]; + int ret; + + snprintf(buf, sizeof(buf), "%ld", offset); + ret = setenv(ENV_TIME_OFFSET, buf, true); + if (ret) + printf("Could not set environment variable %s\n", + ENV_TIME_OFFSET); +} + void os_localtime(struct rtc_time *rt) { time_t t = time(NULL); |