]>
git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Time/TimeEfi.c
2 Transformations between the EFI_TIME structure and struct tm or time_t.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <LibConfig.h>
22 /* Convert an EFI_TIME structure into a C Standard tm structure. */
24 Efi2Tm( EFI_TIME
*ET
, struct tm
*BT
)
26 // Convert EFI time to broken-down time.
27 BT
->tm_year
= ET
->Year
- TM_YEAR_BASE
;
28 BT
->tm_mon
= ET
->Month
- 1; // BD time is zero based, EFI is 1 based
29 BT
->tm_mday
= ET
->Day
;
30 BT
->tm_hour
= ET
->Hour
;
31 BT
->tm_min
= ET
->Minute
;
32 BT
->tm_sec
= ET
->Second
;
34 BT
->tm_zoneoff
= ET
->TimeZone
;
35 BT
->tm_daylight
= ET
->Daylight
;
36 BT
->tm_Nano
= ET
->Nanosecond
;
39 /* Convert an EFI_TIME structure into a time_t value. */
41 Efi2Time( EFI_TIME
*EfiBDtime
)
43 Efi2Tm( EfiBDtime
, &gMD
->BDTime
);
45 return mktime( &gMD
->BDTime
);