Changeset 108794 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
- Timestamp:
- Mar 31, 2025 11:31:09 AM (2 weeks ago)
- svn:sync-xref-src-repo-rev:
- 168237
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-164365 /vendor/edk2/current 103735-103757,103769-103776,129194-168232
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c
r99404 r108794 10 10 #include <Uefi.h> 11 11 #include <CrtLibSupport.h> 12 #include <Library/UefiBootServicesTableLib.h> 12 13 #include <Library/UefiRuntimeServicesTableLib.h> 13 14 … … 19 20 #define SECSPERHOUR (60 * 60) 20 21 #define SECSPERDAY (24 * SECSPERHOUR) 22 23 long timezone; 21 24 22 25 // … … 80 83 } 81 84 85 STATIC 86 time_t 87 CalculateTimeT ( 88 EFI_TIME *Time 89 ) 90 { 91 time_t CalTime; 92 UINTN Year; 93 94 // 95 // Years Handling 96 // UTime should now be set to 00:00:00 on Jan 1 of the current year. 97 // 98 for (Year = 1970, CalTime = 0; Year != Time->Year; Year++) { 99 CalTime = CalTime + (time_t)(CumulativeDays[IsLeap (Year)][13] * SECSPERDAY); 100 } 101 102 // 103 // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment 104 // 105 CalTime = CalTime + 106 (time_t)((Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time->TimeZone * 60) : 0) + 107 (time_t)(CumulativeDays[IsLeap (Time->Year)][Time->Month] * SECSPERDAY) + 108 (time_t)(((Time->Day > 0) ? Time->Day - 1 : 0) * SECSPERDAY) + 109 (time_t)(Time->Hour * SECSPERHOUR) + 110 (time_t)(Time->Minute * 60) + 111 (time_t)Time->Second; 112 113 return CalTime; 114 } 115 82 116 /* Get the system time as seconds elapsed since midnight, January 1, 1970. */ 83 117 // INTN time( … … 92 126 EFI_TIME Time; 93 127 time_t CalTime; 94 UINTN Year;95 128 96 129 // … … 102 135 } 103 136 104 // 105 // Years Handling 106 // UTime should now be set to 00:00:00 on Jan 1 of the current year. 107 // 108 for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) { 109 CalTime = CalTime + (time_t)(CumulativeDays[IsLeap (Year)][13] * SECSPERDAY); 110 } 111 112 // 113 // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment 114 // 115 CalTime = CalTime + 116 (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) + 117 (time_t)(CumulativeDays[IsLeap (Time.Year)][Time.Month] * SECSPERDAY) + 118 (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + 119 (time_t)(Time.Hour * SECSPERHOUR) + 120 (time_t)(Time.Minute * 60) + 121 (time_t)Time.Second; 137 CalTime = CalculateTimeT (&Time); 122 138 123 139 if (timer != NULL) { … … 126 142 127 143 return CalTime; 144 } 145 146 time_t 147 mktime ( 148 struct tm *t 149 ) 150 { 151 EFI_TIME Time; 152 153 Time.Year = (UINT16)t->tm_year; 154 Time.Month = (UINT8)t->tm_mon; 155 Time.Day = (UINT8)t->tm_mday; 156 Time.Hour = (UINT8)t->tm_hour; 157 Time.Minute = (UINT8)t->tm_min; 158 Time.Second = (UINT8)t->tm_sec; 159 Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE; 160 161 return CalculateTimeT (&Time); 128 162 } 129 163 … … 196 230 return GmTime; 197 231 } 232 233 unsigned int 234 sleep ( 235 unsigned int seconds 236 ) 237 { 238 gBS->Stall (seconds * 1000 * 1000); 239 return 0; 240 } 241 242 int 243 gettimeofday ( 244 struct timeval *tv, 245 struct timezone *tz 246 ) 247 { 248 tv->tv_sec = (long)time (NULL); 249 tv->tv_usec = 0; 250 return 0; 251 }
Note:
See TracChangeset
for help on using the changeset viewer.