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 <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Marvin Haeuser <mhaeuser@outlook.de>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
This commit is contained in:
Marvin Haeuser
2019-10-20 20:08:32 +08:00
committed by Liming Gao
parent 17efd446c0
commit 106369fe26

View File

@ -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)) {
//