convert calendar time to local time
#include <time.h> char * ctime( const time_t *timer );
The ctime() function converts the calendar time pointed to by timer to local time, in the form of a string. It's equivalent to
asctime( localtime ( timer ) )
The ctime() function converts the time into a string containing exactly 26 characters. This string has the form shown in the following example:
Sat Mar 21 15:58:27 1987\n\0
All fields have a constant width. The newline character '\n' and the null character '\0' occupy the last two positions of the string.
The ANSI function ctime() places the result string in a static buffer that is reused each time ctime() or asctime() is called. The non-ANSI function _ctime() places the resulting string in the buffer pointed to by buf.
Whenever the ctime() function is called, the tzset() function is also called.
The calendar time is usually obtained by using the time() function. That time is Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)).
The time set on the computer with the QNX date command reflects Coordinated Universal Time. The environment variable TZ is used to establish the local time zone. See the Global Data and the TZ Environment Variable chapter for a discussion of how to set the time zone.
A pointer to the string containing the local time.
See _ctime().
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
asctime(), clock(), _ctime(), difftime(), gmtime(), localtime(), mktime(), strftime(), time(), tzset()