EmbeddedPkg/TimeBaseLib: remove useless truncation to 32-bit

EfiTimeToEpoch() calls EfiGetEpochDays() internally, which (reasonably)
returns a UINTN. But then EfiTimeToEpoch() truncates the EfiGetEpochDays()
retval to UINT32 for no good reason, effectively restricting Time->Year
under 2106.

This truncation was pointed out with a valid warning (= build error) by
VS2019.

Allow EfiTimeToEpoch() to return / propagate a UINTN value.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201221113657.6779-3-lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
This commit is contained in:
Laszlo Ersek 2020-12-21 12:36:57 +01:00 committed by mergify[bot]
parent 3af6c521d9
commit c06635ea3f
2 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ EpochToEfiTime (
/**
Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)
**/
UINT32
UINTN
EFIAPI
EfiTimeToEpoch (
IN EFI_TIME *Time

View File

@ -99,14 +99,14 @@ EfiGetEpochDays (
/**
Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)
**/
UINT32
UINTN
EFIAPI
EfiTimeToEpoch (
IN EFI_TIME *Time
)
{
UINT32 EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY
UINT32 EpochSeconds;
UINTN EpochDays; // Number of days elapsed since EPOCH_JULIAN_DAY
UINTN EpochSeconds;
EpochDays = EfiGetEpochDays (Time);