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

Go to the source code of this file.

Macros

#define EPOCH_JULIAN_DATE   2440588
 
#define SEC_PER_MIN   ((UINTN) 60)
 
#define SEC_PER_HOUR   ((UINTN) 3600)
 
#define SEC_PER_DAY   ((UINTN) 86400)
 

Functions

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)
 
VOID EFIAPI EpochToEfiTime (IN UINTN EpochSeconds, OUT EFI_TIME *Time)
 
UINTN EFIAPI EfiTimeToEpoch (IN EFI_TIME *Time)
 
UINTN EfiTimeToWday (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.h.

Macro Definition Documentation

◆ EPOCH_JULIAN_DATE

#define EPOCH_JULIAN_DATE   2440588

Definition at line 49 of file TimeBaseLib.h.

◆ SEC_PER_DAY

#define SEC_PER_DAY   ((UINTN) 86400)

Definition at line 54 of file TimeBaseLib.h.

◆ SEC_PER_HOUR

#define SEC_PER_HOUR   ((UINTN) 3600)

Definition at line 53 of file TimeBaseLib.h.

◆ SEC_PER_MIN

#define SEC_PER_MIN   ((UINTN) 60)

Definition at line 52 of file TimeBaseLib.h.

Function Documentation

◆ 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.

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

Parameters
[in]Timea pointer to EFI_TIME abstraction.

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.

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

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 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.

Check if it is a leap year.

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

Definition at line 289 of file RealTimeClock.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.