From: Marvin Haeuser Date: Sun, 20 Oct 2019 12:08:32 +0000 (+0800) Subject: ShellPkg/Ls: Consider UEFI timezone may not be set X-Git-Tag: edk2-stable201911~86 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=106369fe26579c2c97131c3dd9e7c7332a5ec575;hp=17efd446c00b414ddeb53ec00b85d780f2f09250;p=mirror_edk2.git 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 --- 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)) { //