/** This is the declaration of an EFI image entry point. This can be the entry point to an application written to this specification, an EFI boot service driver, or an EFI runtime driver. @param ImageHandle Handle that identifies the loaded image. @param SystemTable System Table for this image. @retval EFI_SUCCESS The operation completed successfully. **/ EFI_STATUS EFIAPI InitializeRealTimeClock ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; Status = LibRtcInitialize (ImageHandle, SystemTable); if (EFI_ERROR (Status)) { return Status; } SystemTable->RuntimeServices->GetTime = GetTime; SystemTable->RuntimeServices->SetTime = SetTime; SystemTable->RuntimeServices->GetWakeupTime = GetWakeupTime; SystemTable->RuntimeServices->SetWakeupTime = SetWakeupTime; Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gEfiRealTimeClockArchProtocolGuid, NULL, NULL ); return Status; }
/** This is the declaration of an EFI image entry point. This can be the entry point to an application written to this specification, an EFI boot service driver, or an EFI runtime driver. @param ImageHandle Handle that identifies the loaded image. @param SystemTable System Table for this image. @retval EFI_SUCCESS The operation completed successfully. **/ EFI_STATUS EFIAPI InitializeRealTimeClock ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; UINTN Size; Status = LibRtcInitialize (ImageHandle, SystemTable); if (EFI_ERROR (Status)) { return Status; } Size = sizeof (mTimeSettings); Status = EfiGetVariable ((CHAR16 *)mTimeSettingsVariableName, &gEfiCallerIdGuid, NULL, &Size, (VOID *)&mTimeSettings); if (EFI_ERROR (Status) || !IsValidTimeZone (mTimeSettings.TimeZone) || !IsValidDaylight (mTimeSettings.Daylight)) { DEBUG ((DEBUG_WARN, "%a: using default timezone/daylight settings\n", __FUNCTION__)); mTimeSettings.TimeZone = EFI_UNSPECIFIED_TIMEZONE; mTimeSettings.Daylight = 0; } SystemTable->RuntimeServices->GetTime = GetTime; SystemTable->RuntimeServices->SetTime = SetTime; SystemTable->RuntimeServices->GetWakeupTime = GetWakeupTime; SystemTable->RuntimeServices->SetWakeupTime = SetWakeupTime; Status = gBS->InstallMultipleProtocolInterfaces ( &mHandle, &gEfiRealTimeClockArchProtocolGuid, NULL, NULL ); return Status; }