/* Sets the current local time and date information. */
EFI_STATUS EFIAPI LibSetTime(IN EFI_TIME *Time)
/* Sets the current local time and date information. */
EFI_STATUS EFIAPI LibSetTime(IN EFI_TIME *Time)
{
  EFI_STATUS  Status;
  UINT32      EpochSeconds;
  if ((Time->Year < 1970) || (Time->Year >= 2106)) {
    return EFI_UNSUPPORTED;
  }
  if (!mPL031Initialized) {
    Status = InitializePL031 ();
    if (EFI_ERROR (Status)) {
      return Status;
    }
  }
  EpochSeconds = (UINT32)EfiTimeToEpoch (Time);
  if (Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) {
    EpochSeconds -= Time->TimeZone * SEC_PER_MIN;
  } else if ((Time->Daylight & EFI_TIME_IN_DAYLIGHT) == EFI_TIME_IN_DAYLIGHT) {
    EpochSeconds -= SEC_PER_HOUR;
  }
  MmioWrite32 (mPL031RtcBase + PL031_RTC_LR_LOAD_REGISTER, EpochSeconds);
  return EFI_SUCCESS;
}