1 /* 2 * PROJECT: FreeLoader UEFI Support 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Utils source 5 * COPYRIGHT: Copyright 2022 Justin Miller <justinmiller100@gmail.com> 6 */ 7 8 #include <uefildr.h> 9 10 #include <debug.h> 11 DBG_DEFAULT_CHANNEL(WARNING); 12 13 /* GLOBALS ********************************************************************/ 14 15 extern EFI_SYSTEM_TABLE *GlobalSystemTable; 16 17 /* FUNCTIONS ******************************************************************/ 18 19 TIMEINFO* UefiGetTime(VOID)20UefiGetTime(VOID) 21 { 22 static TIMEINFO TimeInfo; 23 EFI_STATUS Status; 24 EFI_TIME time = {0}; 25 26 Status = GlobalSystemTable->RuntimeServices->GetTime(&time, NULL); 27 if (Status != EFI_SUCCESS) 28 ERR("UefiGetTime: cannot get time status %d\n", Status); 29 30 TimeInfo.Year = time.Year; 31 TimeInfo.Month = time.Month; 32 TimeInfo.Day = time.Day; 33 TimeInfo.Hour = time.Hour; 34 TimeInfo.Minute = time.Minute; 35 TimeInfo.Second = time.Second; 36 return &TimeInfo; 37 } 38 39