From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/chrono%2Fclock_t.html | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 devdocs/c/chrono%2Fclock_t.html (limited to 'devdocs/c/chrono%2Fclock_t.html') diff --git a/devdocs/c/chrono%2Fclock_t.html b/devdocs/c/chrono%2Fclock_t.html new file mode 100644 index 00000000..5946393a --- /dev/null +++ b/devdocs/c/chrono%2Fclock_t.html @@ -0,0 +1,37 @@ +

clock_t

Defined in header <time.h>
typedef /* unspecified */ clock_t;
+

Arithmetic(until C11)Real(since C11) type capable of representing the processor time used by a process. It has implementation-defined range and precision.

+

Example

#include <stdio.h>
+#include <time.h>
+#include <math.h>
+ 
+volatile double sink;
+int main (void)
+{
+  clock_t start = clock();
+ 
+  for(size_t i=0; i<3141592; ++i)
+      sink+=sin(i);
+ 
+  clock_t end = clock();
+  double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
+ 
+  printf("for loop took %f seconds to execute \n", cpu_time_used);
+}

Possible output:

+
for loop took 0.271828 seconds to execute

References

See also

+ + +
returns raw processor clock time since the program is started
(function)
number of processor clock ticks per second
(macro constant)
C++ documentation for clock_t
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/chrono/clock_t +

+
-- cgit v1.2.3