Embellished sample of the time library interface

This library contains various constants and functions for measuring time.  These functions are useful for measuring the time consumption of programs.

// File time.h.
// Interface of the library time.
///////////////////////////////////////////////////////////

#ifndef _TIME_H
#define _TIME_H

#include <stddef.h>


///////////////////////////////////////////////////////////
// Section 1 -- Time measurement
///////////////////////////////////////////////////////////

typedef long time_t;


// This function returns the reading of a wall clock, in
// seconds. The function also assigns the reading of the
// clock to the variable whose address is x (unless x is
// NULL). Usage: instant = time (NULL);

time_t time (time_t *x);


#define CLOCKS_PER_SEC 1000000

typedef long clock_t;

// The function clock returns the CPU time elapsed since
// the beginning of the execution of your program. The time
// is measured in cycles of the internal clock of your
// computer. Each CLOCKS_PER_SEC cycles correspond
// approximately to 1 second. Usage:
// 
//     double start, stop, elapsed;
//     start = (double) clock () / CLOCKS_PER_SEC;
//     . . . [computation] . . .
//     stop = (double) clock () / CLOCKS_PER_SEC;
//     elapsed = stop - start;
// 
// Caution: After approximately 35 minutes, an arithmetic
// overflow occurs.

clock_t clock (void);


#endif