summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include/Library/TimeBaseLib.h
diff options
context:
space:
mode:
authorNhi Pham <nhi@os.amperecomputing.com>2021-01-06 23:09:02 +0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-01-07 16:43:48 +0000
commite31dc4717c75d8e771dfa5c9b1648fa20d88ab0d (patch)
treebdbf235236e0f97c791ad02de8b94d2e7a3b81a9 /EmbeddedPkg/Include/Library/TimeBaseLib.h
parentad16388d69c653333275fcb266617d7fa0c24ff4 (diff)
downloadedk2-e31dc4717c75d8e771dfa5c9b1648fa20d88ab0d.tar.gz
edk2-e31dc4717c75d8e771dfa5c9b1648fa20d88ab0d.tar.bz2
edk2-e31dc4717c75d8e771dfa5c9b1648fa20d88ab0d.zip
EmbeddedPkg/TimeBaseLib: Add function to check Timezone and Daylight
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>
Diffstat (limited to 'EmbeddedPkg/Include/Library/TimeBaseLib.h')
-rw-r--r--EmbeddedPkg/Include/Library/TimeBaseLib.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h
index a9f3c6588b..10700d1a64 100644
--- a/EmbeddedPkg/Include/Library/TimeBaseLib.h
+++ b/EmbeddedPkg/Include/Library/TimeBaseLib.h
@@ -84,6 +84,42 @@ IsDayValid (
);
/**
+ Check if the time zone is valid.
+ Valid values are between -1440 and 1440 or 2047 (EFI_UNSPECIFIED_TIMEZONE).
+
+ @param TimeZone The time zone to be checked.
+
+ @retval TRUE Valid.
+ @retval FALSE Invalid.
+
+**/
+BOOLEAN
+EFIAPI
+IsValidTimeZone (
+ IN INT16 TimeZone
+ );
+
+/**
+ Check if the daylight is valid.
+ Valid values are:
+ 0 : Time is not affected.
+ 1 : Time is affected, and has not been adjusted for daylight savings.
+ 3 : Time is affected, and has been adjusted for daylight savings.
+ All other values are invalid.
+
+ @param Daylight The daylight to be checked.
+
+ @retval TRUE Valid.
+ @retval FALSE Invalid.
+
+**/
+BOOLEAN
+EFIAPI
+IsValidDaylight (
+ IN INT8 Daylight
+ );
+
+/**
Check if the UEFI time is valid.
@param Time The UEFI time to be checked.