C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation\r
for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).\r
\r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
time_t time (time_t *timer)\r
{\r
EFI_TIME Time;\r
+ time_t CalTime;\r
UINTN Year;\r
\r
//\r
// Years Handling\r
// UTime should now be set to 00:00:00 on Jan 1 of the current year.\r
//\r
- for (Year = 1970, *timer = 0; Year != Time.Year; Year++) {\r
- *timer = *timer + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY);\r
+ for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) {\r
+ CalTime = CalTime + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY);\r
}\r
\r
//\r
// Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment\r
//\r
- *timer = *timer + \r
- (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) +\r
- (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) + \r
- (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + \r
- (time_t)(Time.Hour * SECSPERHOUR) + \r
- (time_t)(Time.Minute * 60) + \r
- (time_t)Time.Second;\r
-\r
- return *timer;\r
+ CalTime = CalTime + \r
+ (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) +\r
+ (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) + \r
+ (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) + \r
+ (time_t)(Time.Hour * SECSPERHOUR) + \r
+ (time_t)(Time.Minute * 60) + \r
+ (time_t)Time.Second;\r
+\r
+ if (timer != NULL) {\r
+ *timer = CalTime;\r
+ }\r
+\r
+ return CalTime;\r
}\r
\r
//\r