TianoCore EDK2 master
Loading...
Searching...
No Matches
TimeBaseLib.h
Go to the documentation of this file.
1
11#ifndef _TIME_BASE_LIB_H_
12#define _TIME_BASE_LIB_H_
13
14#include <Uefi/UefiBaseType.h>
15
16//
17// Convenience macros to obtain a build date
18//
19// These macros should work for any compiler that follows ISO/IEC 9899,
20// in which case __DATE__ is defined as a "Mmm dd yyyy" 11 chars string,
21// but add an explicit filter for compilers that have been validated.
22//
23#if (defined (__GNUC__) || defined (_MSC_VER) || defined (__clang__))
24#define TIME_BUILD_YEAR (__DATE__[7] == '?' ? 1900\
25 : (((__DATE__[7] - '0') * 1000 ) \
26 + (__DATE__[8] - '0') * 100 \
27 + (__DATE__[9] - '0') * 10 \
28 + __DATE__[10] - '0'))
29#define TIME_BUILD_MONTH ( __DATE__ [2] == '?' ? 1 \
30 : __DATE__ [2] == 'n' ? ( \
31 __DATE__ [1] == 'a' ? 1 : 6) \
32 : __DATE__ [2] == 'b' ? 2 \
33 : __DATE__ [2] == 'r' ? ( \
34 __DATE__ [0] == 'M' ? 3 : 4) \
35 : __DATE__ [2] == 'y' ? 5 \
36 : __DATE__ [2] == 'l' ? 7 \
37 : __DATE__ [2] == 'g' ? 8 \
38 : __DATE__ [2] == 'p' ? 9 \
39 : __DATE__ [2] == 't' ? 10 \
40 : __DATE__ [2] == 'v' ? 11 \
41 : 12)
42#define TIME_BUILD_DAY ( __DATE__[4] == '?' ? 1 \
43 : ((__DATE__[4] == ' ' ? 0 : \
44 ((__DATE__[4] - '0') * 10)) \
45 + __DATE__[5] - '0'))
46#endif
47
48// Define EPOCH (1970-JANUARY-01) in the Julian Date representation
49#define EPOCH_JULIAN_DATE 2440588
50
51// Seconds per unit
52#define SEC_PER_MIN ((UINTN) 60)
53#define SEC_PER_HOUR ((UINTN) 3600)
54#define SEC_PER_DAY ((UINTN) 86400)
55
65BOOLEAN
66EFIAPI
68 IN EFI_TIME *Time
69 );
70
80BOOLEAN
81EFIAPI
83 IN EFI_TIME *Time
84 );
85
96BOOLEAN
97EFIAPI
99 IN INT16 TimeZone
100 );
101
116BOOLEAN
117EFIAPI
119 IN INT8 Daylight
120 );
121
131BOOLEAN
132EFIAPI
134 IN EFI_TIME *Time
135 );
136
144VOID
145EFIAPI
147 IN UINTN EpochSeconds,
148 OUT EFI_TIME *Time
149 );
150
159UINTN
160EFIAPI
162 IN EFI_TIME *Time
163 );
164
173UINTN
175 IN EFI_TIME *Time
176 );
177
178#endif
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINTN EFIAPI EfiTimeToEpoch(IN EFI_TIME *Time)
Definition: TimeBaseLib.c:119
VOID EFIAPI EpochToEfiTime(IN UINTN EpochSeconds, OUT EFI_TIME *Time)
Definition: TimeBaseLib.c:25
BOOLEAN EFIAPI IsValidTimeZone(IN INT16 TimeZone)
Definition: TimeBaseLib.c:225
BOOLEAN EFIAPI IsTimeValid(IN EFI_TIME *Time)
Definition: TimeBaseLib.c:269
BOOLEAN EFIAPI IsLeapYear(IN EFI_TIME *Time)
BOOLEAN EFIAPI IsDayValid(IN EFI_TIME *Time)
Definition: TimeBaseLib.c:196
BOOLEAN EFIAPI IsValidDaylight(IN INT8 Daylight)
Definition: TimeBaseLib.c:249
UINTN EfiTimeToWday(IN EFI_TIME *Time)
Definition: TimeBaseLib.c:142