• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2 *
3 *  Copyright (c) 2016, Hisilicon Limited. All rights reserved.
4 *  Copyright (c) 2016, Linaro Limited. All rights reserved.
5 *
6 *  This program and the accompanying materials
7 *  are licensed and made available under the terms and conditions of the BSD License
8 *  which accompanies this distribution.  The full text of the license may be found at
9 *  http://opensource.org/licenses/bsd-license.php
10 *
11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 *
14 **/
15 
16 #ifndef _EFI_TIME_BASE_LIB_H_
17 #define _EFI_TIME_BASE_LIB_H_
18 
19 #include <Uefi/UefiBaseType.h>
20 
21 // Seconds per unit
22 #define SEC_PER_MIN                                     ((UINTN)    60)
23 #define SEC_PER_HOUR                                    ((UINTN)  3600)
24 #define SEC_PER_DAY                                     ((UINTN) 86400)
25 
26 BOOLEAN
27 EFIAPI
28 IsLeapYear (
29   IN  EFI_TIME  *Time
30   );
31 
32 BOOLEAN
33 EFIAPI
34 IsDayValid (
35   IN  EFI_TIME  *Time
36   );
37 
38 BOOLEAN
39 EFIAPI
40 IsTimeValid (
41   IN  EFI_TIME  *Time
42   );
43 
44 /**
45   Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME
46  **/
47 VOID
48 EFIAPI
49 EpochToEfiTime (
50   IN  UINTN     EpochSeconds,
51   OUT EFI_TIME  *Time
52   );
53 
54 /**
55   Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC)
56  **/
57 UINTN
58 EfiTimeToEpoch (
59   IN  EFI_TIME  *Time
60   );
61 
62 #endif
63