{{keywords>wiki library source code example reference}}
===== ctime =====
#include
char *ctime(const time_t *timer);
=== Description ===
The ctime() function shall convert the time pointed to by clock, representing time in seconds since the Epoch,
to local time in the form of a string. It shall be equivalent to
asctime(localtime(clock))
1970-01-01 00:00:00 +0000 (UTC).
=== return value ===
The ctime() function shall return the pointer returned by asctime() with that broken-down time as an argument.\\
Upon successful completion, ctime_r() shall return a pointer to the string pointed to by buf. When an error is encountered, a null pointer shall be returned.
===== ctime c example =====
/*
* ctime example code
* http://code-reference.com/c/time.h/ctime
*/
#include
#include
int main(void)
{
time_t time_format;
time(&time_format);
printf("%s\n", ctime(&time_format));
return 0;
}
=== output for this example ===
Mon Apr 23 18:24:18 2012
==== see also ====
[[c:time.h:asctime|asctime()]] [[c:time.h:clock|clock()]] [[c:time.h:difftime|difftime()]] [[c:time.h:gmtime|gmtime()]] [[c:time.h:localtime|localtime()]] [[c:time.h:mktime|mktime()]] [[c:time.h:strftime|strftime()]] [[c:time.h:strptime|strptime()]] [[c:time.h:time|time()]] [[c:utime.h:utime|utime()]]