summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Time
diff options
context:
space:
mode:
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-11 00:32:31 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2011-11-11 00:32:31 +0000
commit8aa163da5ac7bf40d1a3b0612a46504dc56d16a2 (patch)
tree35d16404b59494864d7d04da2c2f0ba9b2889a8b /StdLib/LibC/Time
parent4b3d663f7b2f0db316f20c0ee86c7270c1338852 (diff)
downloadedk2-platforms-8aa163da5ac7bf40d1a3b0612a46504dc56d16a2.tar.xz
StdLib: Eliminate TimerLib dependencies.
Implement the clock() function using the EFI time-of-day clock instead of a TimerLib instance. Signed-off-by: darylm503 Reviewed-by: jljusten Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12683 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/LibC/Time')
-rw-r--r--StdLib/LibC/Time/Time.c50
-rw-r--r--StdLib/LibC/Time/Time.inf1
2 files changed, 22 insertions, 29 deletions
diff --git a/StdLib/LibC/Time/Time.c b/StdLib/LibC/Time/Time.c
index e3eccb593b..0296a5dc93 100644
--- a/StdLib/LibC/Time/Time.c
+++ b/StdLib/LibC/Time/Time.c
@@ -180,34 +180,6 @@ timesub(
/* ############### Time Manipulation Functions ########################## */
-/** The clock function determines the processor time used.
-
- @return The clock function returns the implementation's best
- approximation to the processor time used by the program since the
- beginning of an implementation-defined era related only to the
- program invocation. To determine the time in seconds, the value
- returned by the clock function should be divided by the value of
- the macro CLOCKS_PER_SEC. If the processor time used is not
- available or its value cannot be represented, the function
- returns the value (clock_t)(-1).
-
- On IA32 or X64 platforms, the value returned is the number of
- CPU TimeStamp Counter ticks since the appliation started.
-**/
-clock_t
-clock(void)
-{
-#ifndef NT32dvm
- clock_t temp;
-
- temp = (clock_t)GetPerformanceCounter();
-
- return temp - gMD->AppStartTime;
-#else
- return (clock_t)-1;
-#endif /* NT32dvm */
-}
-
/**
**/
double
@@ -591,6 +563,28 @@ time(time_t *timer)
return CalTime; // Return calendar time in microseconds
}
+/** The clock function determines the processor time used.
+
+ @return The clock function returns the implementation's best
+ approximation to the processor time used by the program since the
+ beginning of an implementation-defined era related only to the
+ program invocation. To determine the time in seconds, the value
+ returned by the clock function should be divided by the value of
+ the macro CLOCKS_PER_SEC. If the processor time used is not
+ available or its value cannot be represented, the function
+ returns the value (clock_t)(-1).
+**/
+clock_t
+clock(void)
+{
+ clock_t retval;
+ time_t temp;
+
+ temp = time(NULL);
+ retval = ((clock_t)((UINT32)temp)) - gMD->AppStartTime;
+ return retval;
+}
+
/* ################# Time Conversion Functions ########################## */
/*
Except for the strftime function, these functions each return a pointer to
diff --git a/StdLib/LibC/Time/Time.inf b/StdLib/LibC/Time/Time.inf
index 3ad226951d..84a47048e4 100644
--- a/StdLib/LibC/Time/Time.inf
+++ b/StdLib/LibC/Time/Time.inf
@@ -43,7 +43,6 @@
[LibraryClasses]
UefiLib
- TimerLib
BaseLib
UefiRuntimeServicesTableLib