]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Time/Time.c
StdLib: Eliminate TimerLib dependencies.
[mirror_edk2.git] / StdLib / LibC / Time / Time.c
index e3eccb593bae3cd144426d7239ecf44678fc83b7..0296a5dc93910871cd3d10e2382fbed2168016e7 100644 (file)
@@ -180,34 +180,6 @@ timesub(
 \r
 /* ###############  Time Manipulation Functions  ########################## */\r
 \r
-/** The clock function determines the processor time used.\r
-\r
-    @return   The clock function returns the implementation's best\r
-              approximation to the processor time used by the program since the\r
-              beginning of an implementation-defined era related only to the\r
-              program invocation.  To determine the time in seconds, the value\r
-              returned by the clock function should be divided by the value of\r
-              the macro CLOCKS_PER_SEC.  If the processor time used is not\r
-              available or its value cannot be represented, the function\r
-              returns the value (clock_t)(-1).\r
-\r
-              On IA32 or X64 platforms, the value returned is the number of\r
-              CPU TimeStamp Counter ticks since the appliation started.\r
-**/\r
-clock_t\r
-clock(void)\r
-{\r
-#ifndef NT32dvm\r
-  clock_t   temp;\r
-\r
-  temp = (clock_t)GetPerformanceCounter();\r
-\r
-  return temp - gMD->AppStartTime;\r
-#else\r
-  return (clock_t)-1;\r
-#endif  /* NT32dvm */\r
-}\r
-\r
 /**\r
 **/\r
 double\r
@@ -591,6 +563,28 @@ time(time_t *timer)
   return CalTime;   // Return calendar time in microseconds\r
 }\r
 \r
+/** The clock function determines the processor time used.\r
+\r
+    @return   The clock function returns the implementation's best\r
+              approximation to the processor time used by the program since the\r
+              beginning of an implementation-defined era related only to the\r
+              program invocation.  To determine the time in seconds, the value\r
+              returned by the clock function should be divided by the value of\r
+              the macro CLOCKS_PER_SEC.  If the processor time used is not\r
+              available or its value cannot be represented, the function\r
+              returns the value (clock_t)(-1).\r
+**/\r
+clock_t\r
+clock(void)\r
+{\r
+  clock_t   retval;\r
+  time_t    temp;\r
+\r
+  temp = time(NULL);\r
+  retval = ((clock_t)((UINT32)temp)) - gMD->AppStartTime;\r
+  return retval;\r
+}\r
+\r
 /* #################  Time Conversion Functions  ########################## */\r
 /*\r
     Except for the strftime function, these functions each return a pointer to\r