A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../algorithm/../../cpp/../c/chrono/clock_t.html below:

clock_t - cppreference.com

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.

[edit] 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
[edit] References
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4