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
This commit is contained in:
darylm503
2011-11-11 00:32:31 +00:00
parent 4b3d663f7b
commit 8aa163da5a
5 changed files with 36 additions and 76 deletions

View File

@@ -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