summaryrefslogtreecommitdiff
path: root/Cryptlib/SysCall/TimerWrapper.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2016-10-01 14:18:49 -0700
committerSteve Langasek <steve.langasek@canonical.com>2016-10-01 14:18:49 -0700
commitb65e78ec015a308c1798e602c94502327cc90cd9 (patch)
tree4185dc52bcba0af1f815b88e100cd68a626916ca /Cryptlib/SysCall/TimerWrapper.c
parent21ebe03556d7030055644f46efd3c165396a7a75 (diff)
parent86b44a70f0e22233427cef3e966869e59b5e9dd5 (diff)
downloadefi-boot-shim-b65e78ec015a308c1798e602c94502327cc90cd9.tar.gz
efi-boot-shim-b65e78ec015a308c1798e602c94502327cc90cd9.zip
Resync with Ubuntu, including patch to fix debian/copyright.
Diffstat (limited to 'Cryptlib/SysCall/TimerWrapper.c')
-rw-r--r--Cryptlib/SysCall/TimerWrapper.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/Cryptlib/SysCall/TimerWrapper.c b/Cryptlib/SysCall/TimerWrapper.c
index cee72ba5..27ac44a3 100644
--- a/Cryptlib/SysCall/TimerWrapper.c
+++ b/Cryptlib/SysCall/TimerWrapper.c
@@ -2,7 +2,7 @@
C Run-Time Libraries (CRT) Time Management Routines Wrapper Implementation
for OpenSSL-based Cryptographic Library (used in DXE & RUNTIME).
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -71,6 +71,7 @@ UINTN CumulativeDays[2][14] = {
time_t time (time_t *timer)
{
EFI_TIME Time;
+ time_t CalTime;
UINTN Year;
//
@@ -82,22 +83,26 @@ time_t time (time_t *timer)
// Years Handling
// UTime should now be set to 00:00:00 on Jan 1 of the current year.
//
- for (Year = 1970, *timer = 0; Year != Time.Year; Year++) {
- *timer = *timer + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY);
+ for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) {
+ CalTime = CalTime + (time_t)(CumulativeDays[IsLeap(Year)][13] * SECSPERDAY);
}
//
// Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment
//
- *timer = *timer +
- (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) +
- (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) +
- (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) +
- (time_t)(Time.Hour * SECSPERHOUR) +
- (time_t)(Time.Minute * 60) +
- (time_t)Time.Second;
-
- return *timer;
+ CalTime = CalTime +
+ (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) +
+ (time_t)(CumulativeDays[IsLeap(Time.Year)][Time.Month] * SECSPERDAY) +
+ (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) +
+ (time_t)(Time.Hour * SECSPERHOUR) +
+ (time_t)(Time.Minute * 60) +
+ (time_t)Time.Second;
+
+ if (timer != NULL) {
+ *timer = CalTime;
+ }
+
+ return CalTime;
}
//