Time Functions

In the ANSI library, there also are several function to get the current time. In an embedded systems environment, implementations for these functions cannot be provided because different targets may use different ways to count the time.

Listing: ANSI-C time functions


clock_t   clock(void);
time_t    time(time_t *time_val);

struct tm * localtime(const time_t *time_val);

time_t    mktime(struct tm *time_rec);

char      * asctime(const struct tm *time_rec);

char      ctime(const time *time_val);

size_t    strftime(char *s, size_t n,

                   const char *format,

                   const struct tm *time_rec);

double    difftime(time_t t1, time_t t2);

struct tm * gmtime(const time_t *time_val);