From e49865a467d7eaabb43c6af66e0598abe47a94f0 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Tue, 24 Oct 2023 06:34:03 +0200 Subject: [PATCH] lib/time: EFI: Return time of 0 if GetTime() unsupported --- common/lib/time.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/lib/time.c b/common/lib/time.c index f5643353..da82dbbe 100644 --- a/common/lib/time.c +++ b/common/lib/time.c @@ -63,7 +63,11 @@ again: #if defined (UEFI) uint64_t time(void) { EFI_TIME time; - gRT->GetTime(&time, NULL); + EFI_STATUS status = gRT->GetTime(&time, NULL); + + if (status != 0) { + return 0; + } return get_unix_epoch(time.Second, time.Minute, time.Hour, time.Day, time.Month, time.Year);