ctime()

convert epoch time to local time 

Function


SYNOPSIS

#include <time.h>

char *ctime(const time_t *clock);


DESCRIPTION

The ctime() function converts the epoch time pointed to by clock to local time in the form of a string. It is equivalent to:

asctime(localtime(clock));

The string returned by ctime() is in the form:

Sun Sep 16 01:03:52 1973\n\0

A side-effect of calling ctime() is that the global variables tzname, timezone, and daylight are set based on the value of environment variable TZ, exactly as though the function tzset() had been called. The string returned by ctime() is in the local time specified by TZ.

This function is not reentrant; see ctime_r() for a reentrant version.


PARAMETERS

clock 

Points to the time to be converted to string format.


RETURN VALUES

On success, the ctime() function returns a pointer to a static buffer containing the time in the format shown above. This static buffer is shared with asctime(); subsequent calls to ctime() or asctime() overwrite this buffer. On error, it returns NULL.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

Refer to tzset() for details on setting time zone information.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
asctime(), asctime_r(), clock(), ctime_r(), difftime(), gmtime(), gmtime_r(), localtime(), localtime_r(), mktime(), strftime(), time(), tzset(), wcsftime()


PTC MKS Toolkit 10.3 Documentation Build 39.