]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Include/Library/TimeBaseLib.h
EmbeddedPkg: import EfiTimeBaseLib (as TimeBaseLib)
[mirror_edk2.git] / EmbeddedPkg / Include / Library / TimeBaseLib.h
diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h
new file mode 100644 (file)
index 0000000..fe3618e
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file\r
+*\r
+*  Copyright (c) 2016, Hisilicon Limited. All rights reserved.\r
+*  Copyright (c) 2016, Linaro Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#ifndef _TIME_BASE_LIB_H_\r
+#define _TIME_BASE_LIB_H_\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+\r
+// Define EPOCH (1970-JANUARY-01) in the Julian Date representation\r
+#define EPOCH_JULIAN_DATE                               2440588\r
+\r
+// Seconds per unit\r
+#define SEC_PER_MIN                                     ((UINTN)    60)\r
+#define SEC_PER_HOUR                                    ((UINTN)  3600)\r
+#define SEC_PER_DAY                                     ((UINTN) 86400)\r
+#define SEC_PER_MONTH                                   ((UINTN)  2,592,000)\r
+#define SEC_PER_YEAR                                    ((UINTN) 31,536,000)\r
+\r
+BOOLEAN\r
+EFIAPI\r
+IsLeapYear (\r
+  IN  EFI_TIME  *Time\r
+  );\r
+\r
+BOOLEAN\r
+EFIAPI\r
+IsDayValid (\r
+  IN  EFI_TIME  *Time\r
+  );\r
+\r
+BOOLEAN\r
+EFIAPI\r
+IsTimeValid (\r
+  IN  EFI_TIME  *Time\r
+  );\r
+\r
+/**\r
+  Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME\r
+ **/\r
+VOID\r
+EFIAPI\r
+EpochToEfiTime (\r
+  IN  UINTN     EpochSeconds,\r
+  OUT EFI_TIME  *Time\r
+  );\r
+\r
+/**\r
+  Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)\r
+ **/\r
+UINTN\r
+EFIAPI\r
+EfiTimeToEpoch (\r
+  IN  EFI_TIME  *Time\r
+  );\r
+\r
+#endif\r