\r
JulianDate = Time->Day + ((153*m + 2)/5) + (365*y) + (y/4) - (y/100) + (y/400) - 32045;\r
\r
- ASSERT(JulianDate > EPOCH_JULIAN_DATE);\r
+ ASSERT (JulianDate >= EPOCH_JULIAN_DATE);\r
EpochDays = JulianDate - EPOCH_JULIAN_DATE;\r
\r
EpochSeconds = (EpochDays * SEC_PER_DAY) + ((UINTN)Time->Hour * SEC_PER_HOUR) + (Time->Minute * SEC_PER_MIN) + Time->Second;\r
EFI_STATUS Status;\r
UINTN EpochSeconds;\r
\r
- // Because the PL031 is a 32-bit counter counting seconds,\r
- // the maximum time span is just over 136 years.\r
- // Time is stored in Unix Epoch format, so it starts in 1970,\r
- // Therefore it can not exceed the year 2106.\r
- // This is not a problem for UEFI, as the current spec limits the years\r
- // to the range 1998 .. 2011\r
-\r
- // Check the input parameters' range.\r
- if ((Time->Year < 1998) ||\r
- (Time->Year > 2099) ||\r
+ // Check the input parameters are within the range specified by UEFI\r
+ if ((Time->Year < 1900) ||\r
+ (Time->Year > 9999) ||\r
(Time->Month < 1 ) ||\r
(Time->Month > 12 ) ||\r
(!DayValid (Time) ) ||\r
goto EXIT;\r
}\r
\r
+ // Because the PL031 is a 32-bit counter counting seconds,\r
+ // the maximum time span is just over 136 years.\r
+ // Time is stored in Unix Epoch format, so it starts in 1970,\r
+ // Therefore it can not exceed the year 2106.\r
+ if ((Time->Year < 1970) || (Time->Year >= 2106)) {\r
+ Status = EFI_UNSUPPORTED;\r
+ goto EXIT;\r
+ }\r
+\r
// Initialize the hardware if not already done\r
if (!mPL031Initialized) {\r
Status = InitializePL031 ();\r