TianoCore EDK2 master
Loading...
Searching...
No Matches
TimeBaseLib.c File Reference

Go to the source code of this file.

Functions

VOID EFIAPI EpochToEfiTime (IN UINTN EpochSeconds, OUT EFI_TIME *Time)
 
UINTN EFIAPI EfiGetEpochDays (IN EFI_TIME *Time)
 
UINTN EFIAPI EfiTimeToEpoch (IN EFI_TIME *Time)
 
UINTN EfiTimeToWday (IN EFI_TIME *Time)
 
BOOLEAN EFIAPI IsLeapYear (IN EFI_TIME *Time)
 
BOOLEAN EFIAPI IsDayValid (IN EFI_TIME *Time)
 
BOOLEAN EFIAPI IsValidTimeZone (IN INT16 TimeZone)
 
BOOLEAN EFIAPI IsValidDaylight (IN INT8 Daylight)
 
BOOLEAN EFIAPI IsTimeValid (IN EFI_TIME *Time)
 

Detailed Description

Copyright (c) 2016, Hisilicon Limited. All rights reserved. Copyright (c) 2016-2019, Linaro Limited. All rights reserved. Copyright (c) 2021, Ampere Computing LLC. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TimeBaseLib.c.

Function Documentation

◆ EfiGetEpochDays()

UINTN EFIAPI EfiGetEpochDays ( IN EFI_TIME Time)

Calculate Epoch days.

Parameters
TimeThe UEFI time to be calculated.
Returns
Number of days.

Definition at line 87 of file TimeBaseLib.c.

◆ EfiTimeToEpoch()

UINTN EFIAPI EfiTimeToEpoch ( IN EFI_TIME Time)

Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC).

Parameters
TimeThe UEFI time to be converted.
Returns
Number of seconds.

Definition at line 119 of file TimeBaseLib.c.

◆ EfiTimeToWday()

UINTN EfiTimeToWday ( IN EFI_TIME Time)

Get the day of the week from the UEFI time.

Parameters
TimeThe UEFI time to be calculated.
Returns
The day of the week: Sunday=0, Monday=1, ... Saturday=6

Definition at line 142 of file TimeBaseLib.c.

◆ EpochToEfiTime()

VOID EFIAPI EpochToEfiTime ( IN UINTN  EpochSeconds,
OUT EFI_TIME Time 
)

Converts Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC) to EFI_TIME.

Parameters
EpochSecondsEpoch seconds.
TimeThe time converted to UEFI format.

Definition at line 25 of file TimeBaseLib.c.

◆ IsDayValid()

BOOLEAN EFIAPI IsDayValid ( IN EFI_TIME Time)

Check if the day in the UEFI time is valid.

Parameters
TimeThe UEFI time to be checked.
Return values
TRUEValid.
FALSEInvalid.

Definition at line 196 of file TimeBaseLib.c.

◆ IsLeapYear()

BOOLEAN EFIAPI IsLeapYear ( IN EFI_TIME Time)

Check if it is a leap year.

Parameters
TimeThe UEFI time to be checked.
Return values
TRUEIt is a leap year.
FALSEIt is NOT a leap year.

Definition at line 166 of file TimeBaseLib.c.

◆ IsTimeValid()

BOOLEAN EFIAPI IsTimeValid ( IN EFI_TIME Time)

Check if the UEFI time is valid.

Parameters
TimeThe UEFI time to be checked.
Return values
TRUEValid.
FALSEInvalid.

Definition at line 269 of file TimeBaseLib.c.

◆ IsValidDaylight()

BOOLEAN EFIAPI IsValidDaylight ( IN INT8  Daylight)

Check if the daylight is valid. Valid values are: 0 : Time is not affected. 1 : Time is affected, and has not been adjusted for daylight savings. 3 : Time is affected, and has been adjusted for daylight savings. All other values are invalid.

Parameters
DaylightThe daylight to be checked.
Return values
TRUEValid.
FALSEInvalid.

Definition at line 249 of file TimeBaseLib.c.

◆ IsValidTimeZone()

BOOLEAN EFIAPI IsValidTimeZone ( IN INT16  TimeZone)

Check if the time zone is valid. Valid values are between -1440 and 1440 or 2047 (EFI_UNSPECIFIED_TIMEZONE).

Parameters
TimeZoneThe time zone to be checked.
Return values
TRUEValid.
FALSEInvalid.

Definition at line 225 of file TimeBaseLib.c.