summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include/Library/TimeBaseLib.h
Commit message (Collapse)AuthorAgeFilesLines
* EmbeddedPkg: Apply uncrustify changesMichael Kubacki2021-12-071-8/+8
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the EmbeddedPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Andrew Fish <afish@apple.com>
* EmbeddedPkg/TimeBaseLib: Add function to check Timezone and DaylightNhi Pham2021-01-071-0/+36
| | | | | | | | | | | | This adds two functions IsValidTimeZone() and IsValidDaylight() to check the time zone and daylight value from EFI time. These functions are retrieved from the RealTimeClockRuntimeDxe module as they reduce duplicated code in RTC modules. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
* EmbeddedPkg/TimeBaseLib: Update comment blocks for API functionsNhi Pham2021-01-071-6/+48
| | | | | | | | | This updates Doxygen comment blocks for API library functions. Cc: Leif Lindholm <leif@nuviainc.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
* EmbeddedPkg/TimeBaseLib: remove useless truncation to 32-bitLaszlo Ersek2020-12-211-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* EmbeddedPkg/TimeBaseLib: remove the SEC_PER_MONTH, SEC_PER_YEAR macrosLaszlo Ersek2020-09-081-2/+0
| | | | | | | | | | | | | | | | | | The SEC_PER_MONTH and SEC_PER_YEAR macros are wrong: they both evaluate to 0 (of type "int"). They are also unused (they could never be used for division, for example); so remove them. The macros were originally introduced in commit 0f4386e775c7 ("ArmPlatformPkg/PL031RealTimeClockLib: Implement PL031 RTC drive", 2011-06-11). Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Reported-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200904154541.23340-1-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
* EmbeddedPkg/TimeBaseLib: Add macros to get build year/month/dayPete Batard2020-08-031-0/+32
| | | | | | | | | | | | | | | | | | These can be used, for instance, to automate the population of an SMBIOS Type 0 BIOS Release Date when building a UEFI firmware (which is how we plan to use these macros for the Raspberry Pi platform). These macros should work for any compiler that follows ISO/IEC 9899, but we add a check for the compiler we have tested to be on the safe side. Note that we decided against adding a #error or #warn for compilers that haven't been validated, as we don't want to introduce breakage for people who may already be using the header with something else than gcc, MSVC or Clang. Instead, we expect those to send a patch that adds their compiler to the list, once they have tested the macros there. Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
* EmbeddedPkg: improve TimeBaseLib type safetyLeif Lindholm2019-06-171-2/+2
| | | | | | | | | | | | | | | EfiTimeToEpoch currently returns a UINTN. Also, some internal calculations was using UINTN for fixed-width. Both of these lead to warnings/errors with VS2017. Replace with appropriate fixed-size types. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=997 Cc: Alexei Fedorov <Alexei.Fedorov@arm.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* EmbeddedPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* EmbeddedPkg/TimeBaseLib: Add function to get Week day.Meenakshi Aggarwal2018-06-051-0/+8
| | | | | | | | | | | This patch add function EfiTimeToWday() which returns day of the week. It is needed by our upcoming patches in edk2-platforms. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* EmbeddedPkg: import EfiTimeBaseLib (as TimeBaseLib)Leif Lindholm2017-05-101-0/+68
Some generic RTC helper functions were broken out from the PL031 library for use with other RTCs in OpenPlatformPkg. Import the code back here, realigning it with the current state of PL031RealTimeClockLib to simplify comparisons. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>