From 106369fe26579c2c97131c3dd9e7c7332a5ec575 Mon Sep 17 00:00:00 2001 From: Marvin Haeuser Date: Sun, 20 Oct 2019 20:08:32 +0800 Subject: ShellPkg/Ls: Consider UEFI timezone may not be set REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2294 EFI_RUNTIME_SERVICES.GetTime() might return an unspecified Timezone, such as when SetTime() has not been called after the RTC was cut off power. Consider this case by not attempting Timezone translations for when it is invalid. Cc: Ray Ni Cc: Zhichao Gao Signed-off-by: Marvin Haeuser Reviewed-by: Zhichao Gao --- ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index adeb987e6e..1a65f60c3b 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -500,7 +500,7 @@ PrintLsOutput( // Change the file time to local time. // Status = gRT->GetTime(&LocalTime, NULL); - if (!EFI_ERROR (Status)) { + if (!EFI_ERROR (Status) && (LocalTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE)) { if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) && (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) { // -- cgit v1.2.3