COHERENT manpages

This page displays the COHERENT manpage for ctime() [Convert system time to an ASCII string].

List of available manpages
Index


ctime() -- Time Function (libc)

Convert system time to an ASCII string
#include <time.h>
#include <sys/types.h>
char *ctime(timep)
time_t *timep;

ctime() converts the system's internal time  into a string that can be read
by humans.  It  takes a pointer to the internal  time type time_t, which is
defined in the  header file <sys/types.h>, and returns a fixed-length
string of the form:

    Thu Mar  7 11:12:14 1989\n

ctime()  is implemented  as a  call to  localtime() followed  by a  call to
asctime().

Example

For another example of this function, see the entry for asctime().

#include <time.h>
#include <sys/types.h>

main()
{
    time_t t;

    time(&t);
    printf("%s\n", ctime(&t));
}

See Also

libc,
time [overview],
time.h
ANSI Standard, §7.12.3.2
POSIX Standard, §8.1

Notes

ctime()  returns a  pointer to  a  statically allocated  data area  that is
overwritten by successive calls.