47 J = (EpochSeconds / 86400) + 2440588;
51 c = (((dg / 36524) + 1) * 3) / 4;
52 dc = dg - (c * 36524);
55 a = (((db / 365) + 1) * 3) / 4;
57 y = (g * 400) + (c * 100) + (b * 4) + a;
58 m = (((da * 5) + 308) / 153) - 2;
59 d = da - (((m + 4) * 153) / 5) + 122;
61 Time->Year = (UINT16)(y - 4800 + ((m + 2) / 12));
62 Time->Month = ((m + 2) % 12) + 1;
63 Time->Day = (UINT8)(d + 1);
65 ss = EpochSeconds % 60;
66 a = (EpochSeconds - ss) / 60;
71 Time->Hour = (UINT8)hh;
72 Time->Minute = (UINT8)mm;
73 Time->Second = (UINT8)ss;
97 a = (14 - Time->Month) / 12;
98 y = Time->Year + 4800 - a;
99 m = Time->Month + (12*a) - 3;
101 JulianDate = Time->Day + ((153*m + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045;
103 ASSERT (JulianDate >= EPOCH_JULIAN_DATE);
104 EpochDays = JulianDate - EPOCH_JULIAN_DATE;
128 EpochSeconds = (EpochDays * SEC_PER_DAY) + ((
UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second;
152 return (EpochDays + 4) % 7;
170 if (Time->Year % 4 == 0) {
171 if (Time->Year % 100 == 0) {
172 if (Time->Year % 400 == 0) {
200 STATIC CONST INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
202 if ((Time->Day < 1) ||
203 (Time->Day > DayOfMonth[Time->Month - 1]) ||
204 ((Time->Month == 2) && (!
IsLeapYear (Time) && (Time->Day > 28)))
230 (TimeZone >= -1440 && TimeZone <= 1440);
253 return Daylight == 0 ||
254 Daylight == EFI_TIME_ADJUST_DAYLIGHT ||
255 Daylight == (EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT);
274 if ((Time->Year < 2000) ||
275 (Time->Year > 2099) ||
277 (Time->Month > 12) ||
280 (Time->Minute > 59) ||
281 (Time->Second > 59) ||
282 (Time->Nanosecond > 999999999) ||
UINTN EFIAPI EfiTimeToEpoch(IN EFI_TIME *Time)
VOID EFIAPI EpochToEfiTime(IN UINTN EpochSeconds, OUT EFI_TIME *Time)
BOOLEAN EFIAPI IsValidTimeZone(IN INT16 TimeZone)
BOOLEAN EFIAPI IsTimeValid(IN EFI_TIME *Time)
UINTN EFIAPI EfiGetEpochDays(IN EFI_TIME *Time)
BOOLEAN EFIAPI IsDayValid(IN EFI_TIME *Time)
BOOLEAN EFIAPI IsValidDaylight(IN INT8 Daylight)
BOOLEAN EFIAPI IsLeapYear(IN EFI_TIME *Time)
UINTN EfiTimeToWday(IN EFI_TIME *Time)
#define EFI_UNSPECIFIED_TIMEZONE