CTIME(3) CTIME(3) NAME ctime, localtime, gmtime, asctime, timezone - convert date and time to ASCII SYNOPSIS char *ctime(clock) long *clock; #include struct tm *localtime(clock) long *clock; struct tm *gmtime(clock) long *clock; char *asctime(tm) struct tm *tm; char *timezone(zone, dst) DESCRIPTION _C_t_i_m_e converts a time pointed to by _c_l_o_c_k such as returned by _t_i_m_e(2) into ASCII and returns a pointer to a 26-character string in the fol‐ lowing form. All the fields have constant width. Sun Sep 16 01:03:52 1973\n\0 _L_o_c_a_l_t_i_m_e and _g_m_t_i_m_e return pointers to structures containing the bro‐ ken-down time. _L_o_c_a_l_t_i_m_e corrects for the time zone and possible day‐ light savings time; _g_m_t_i_m_e converts directly to GMT, which is the time UNIX uses. _A_s_c_t_i_m_e converts a broken-down time to ASCII and returns a pointer to a 26-character string. The structure declaration from the include file is: struct tm { int tm_sec; /* 0-59 seconds */ int tm_min; /* 0-59 minutes */ int tm_hour; /* 0-23 hour */ int tm_mday; /* 1-31 day of month */ int tm_mon; /* 0-11 month */ int tm_year; /* 0- year - 1900 */ int tm_wday; /* 0-6 day of week (Sunday = 0) */ int tm_yday; /* 0-365 day of year */ int tm_isdst; /* flag: daylight savings time in effect */ }; When local time is called for, the program consults the system to determine the time zone and whether the U.S.A., Australian, Eastern European, Middle European, or Western European daylight saving time adjustment is appropriate. The program knows about various peculiari‐ ties in time conversion over the past 10-20 years; if necessary, this understanding can be extended. _T_i_m_e_z_o_n_e returns the name of the time zone associated with its first argument, which is measured in minutes westward from Greenwich. If the second argument is 0, the standard name is used, otherwise the Daylight Saving version. If the required name does not appear in a table built into the routine, the difference from GMT is produced; e.g., in Afghanistan _t_i_m_e_z_o_n_e_(_-_(_6_0_*_4_+_3_0_)_, _0_) is appropriate because it is 4:30 ahead of GMT and the string GMT+4:30 is produced. SEE ALSO gettimeofday(2), time(3) BUGS The return values point to static data whose content is overwritten by each call. 4th Berkeley Distribution May 27, 1986 CTIME(3)