]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - EmbeddedPkg/Include/Library/TimeBaseLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / EmbeddedPkg / Include / Library / TimeBaseLib.h
... / ...
CommitLineData
1/** @file\r
2*\r
3* Copyright (c) 2016, Hisilicon Limited. All rights reserved.\r
4* Copyright (c) 2016-2019, Linaro Limited. All rights reserved.\r
5*\r
6* SPDX-License-Identifier: BSD-2-Clause-Patent\r
7*\r
8**/\r
9\r
10#ifndef _TIME_BASE_LIB_H_\r
11#define _TIME_BASE_LIB_H_\r
12\r
13#include <Uefi/UefiBaseType.h>\r
14\r
15// Define EPOCH (1970-JANUARY-01) in the Julian Date representation\r
16#define EPOCH_JULIAN_DATE 2440588\r
17\r
18// Seconds per unit\r
19#define SEC_PER_MIN ((UINTN) 60)\r
20#define SEC_PER_HOUR ((UINTN) 3600)\r
21#define SEC_PER_DAY ((UINTN) 86400)\r
22#define SEC_PER_MONTH ((UINTN) 2,592,000)\r
23#define SEC_PER_YEAR ((UINTN) 31,536,000)\r
24\r
25BOOLEAN\r
26EFIAPI\r
27IsLeapYear (\r
28 IN EFI_TIME *Time\r
29 );\r
30\r
31BOOLEAN\r
32EFIAPI\r
33IsDayValid (\r
34 IN EFI_TIME *Time\r
35 );\r
36\r
37BOOLEAN\r
38EFIAPI\r
39IsTimeValid (\r
40 IN EFI_TIME *Time\r
41 );\r
42\r
43/**\r
44 Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME\r
45 **/\r
46VOID\r
47EFIAPI\r
48EpochToEfiTime (\r
49 IN UINTN EpochSeconds,\r
50 OUT EFI_TIME *Time\r
51 );\r
52\r
53/**\r
54 Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)\r
55 **/\r
56UINT32\r
57EFIAPI\r
58EfiTimeToEpoch (\r
59 IN EFI_TIME *Time\r
60 );\r
61\r
62/**\r
63 returns Day of the week [0-6] 0=Sunday\r
64 **/\r
65UINTN\r
66EfiTimeToWday (\r
67 IN EFI_TIME *Time\r
68 );\r
69\r
70#endif\r