Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <time.h>
    clock_t clock(void);

Description:
    The clock function returns the number of clock ticks of processor time
    used by program since the program started executing.  This can be
    converted to seconds by dividing by the value of the macro
     CLOCKS_PER_SEC.

    Note that under DOS and OS/2, the clock tick counter will reset to 0 for
    each subsequent 24 hour interval that elapses.

Returns:
    The clock function returns the number of clock ticks that have occurred
    since the program started executing.

Example:
    #include <stdio.h>
    #include <math.h>
    #include <time.h>

    void compute( void )
      {
        int i, j;
        double x;

        x = 0.0;
        for( i = 1; i <= 100; i++ )
          for( j = 1; j <= 100; j++ )
            x += sqrt( (double) i * j );
        printf( "%16.7f\n", x );
      }

    void main()
      {
        clock_t start_time, end_time;

        start_time = clock();
        compute();
        end_time = clock();
        printf( "Execution time was %lu seconds\n",
              (end_time - start_time) / CLOCKS_PER_SEC );
      }

Classification:
    ANSI

Systems:
    All, Netware

See Also:
    asctime, ctime, difftime, gmtime, localtime, mktime, strftime, time,
    tzset

See Also: difftime mktime

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson