]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg/Ls: Consider UEFI timezone may not be set
authorMarvin Haeuser <mhaeuser@outlook.de>
Sun, 20 Oct 2019 12:08:32 +0000 (20:08 +0800)
committerLiming Gao <liming.gao@intel.com>
Mon, 4 Nov 2019 02:46:02 +0000 (10:46 +0800)
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>
ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c

index adeb987e6ecba93fd65d414bb301c73814b76467..1a65f60c3b44bd723e4870b95a75c982f453b325 100644 (file)
@@ -500,7 +500,7 @@ PrintLsOutput(
       // Change the file time to local time.\r
       //\r
       Status = gRT->GetTime(&LocalTime, NULL);\r
-      if (!EFI_ERROR (Status)) {\r
+      if (!EFI_ERROR (Status) && (LocalTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE)) {\r
         if ((Node->Info->CreateTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) &&\r
             (Node->Info->CreateTime.Month >= 1 && Node->Info->CreateTime.Month <= 12)) {\r
           //\r