Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

1. C Pocket Reference > 1.24. Time and Date

Time and Date

The ANSI C library includes a set of functions to determine the current time and date, to convert time and date information, and to generate formatted time and date strings for output. These functions are declared in the header file time.h .

The principal functions for determining the current time are:

clock_t clock( void );

Returns the CPU time used by the program so far, with type clock_t (usually equivalent to long). The result can be converted to seconds by dividing it by the constant CLOCKS_PER_SEC .

time_t time( time_t *pSec );

Returns the number of seconds that have elapsed since a certain time (usually January 1, 1970, 00:00:00 o’clock). If the pointer


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint