summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
diff options
context:
space:
mode:
Diffstat (limited to 'EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c')
-rw-r--r--EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c75
1 files changed, 41 insertions, 34 deletions
diff --git a/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c b/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
index c2f980ddc5..9437b2ae98 100644
--- a/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
+++ b/EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.c
@@ -25,27 +25,28 @@ DayValid (
BOOLEAN
IsLeapYear (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
);
EFI_STATUS
RtcTimeFieldsValid (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
);
EFI_STATUS
EFIAPI
InitializeRealTimeClock (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
EFI_STATUS
EFIAPI
EmuGetTime (
- OUT EFI_TIME * Time,
- OUT EFI_TIME_CAPABILITIES * Capabilities OPTIONAL
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
)
+
/*++
Routine Description:
@@ -67,13 +68,11 @@ Returns:
**/
{
-
//
// Check parameter for null pointer
//
if (Time == NULL) {
return EFI_INVALID_PARAMETER;
-
}
gEmuThunk->GetTime (Time, Capabilities);
@@ -84,8 +83,9 @@ Returns:
EFI_STATUS
EFIAPI
EmuSetTime (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
+
/*++
Routine Description:
@@ -106,11 +106,12 @@ Returns:
**/
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
if (Time == NULL) {
return EFI_INVALID_PARAMETER;
}
+
//
// Make sure that the time fields are valid
//
@@ -118,16 +119,18 @@ Returns:
if (EFI_ERROR (Status)) {
return Status;
}
+
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
EmuGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
+ OUT BOOLEAN *Enabled,
+ OUT BOOLEAN *Pending,
+ OUT EFI_TIME *Time
)
+
/*++
Routine Description:
@@ -159,9 +162,10 @@ Returns:
EFI_STATUS
EFIAPI
EmuSetWakeupTime (
- IN BOOLEAN Enable,
- OUT EFI_TIME *Time
+ IN BOOLEAN Enable,
+ OUT EFI_TIME *Time
)
+
/*++
Routine Description:
@@ -193,9 +197,10 @@ Returns:
EFI_STATUS
EFIAPI
InitializeRealTimeClock (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
+
/*++
Routine Description:
@@ -231,8 +236,9 @@ Returns:
EFI_STATUS
RtcTimeFieldsValid (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
+
/*++
Routine Description:
@@ -242,18 +248,19 @@ Routine Description:
Returns:
**/
{
- if (Time->Year < 1998 ||
- Time->Year > 2099 ||
- Time->Month < 1 ||
- Time->Month > 12 ||
+ if ((Time->Year < 1998) ||
+ (Time->Year > 2099) ||
+ (Time->Month < 1) ||
+ (Time->Month > 12) ||
(!DayValid (Time)) ||
- Time->Hour > 23 ||
- Time->Minute > 59 ||
- Time->Second > 59 ||
- Time->Nanosecond > 999999999 ||
- (!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||
+ (Time->Hour > 23) ||
+ (Time->Minute > 59) ||
+ (Time->Second > 59) ||
+ (Time->Nanosecond > 999999999) ||
+ (!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) ||
(Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT)))
- ) {
+ )
+ {
return EFI_INVALID_PARAMETER;
}
@@ -265,13 +272,13 @@ DayValid (
IN EFI_TIME *Time
)
{
-
STATIC const INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- if (Time->Day < 1 ||
- Time->Day > DayOfMonth[Time->Month - 1] ||
- (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
- ) {
+ if ((Time->Day < 1) ||
+ (Time->Day > DayOfMonth[Time->Month - 1]) ||
+ ((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28)))
+ )
+ {
return FALSE;
}
@@ -280,7 +287,7 @@ DayValid (
BOOLEAN
IsLeapYear (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
{
if (Time->Year % 4 == 0) {