CTIME(3C) UNIX Programmer's Manual CTIME(3C) NAME ctime, daylight, localtime, gmtime, asctime, timezone, tzset, tzname - 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; tzset ( ) extern long timezone; extern daylight; extern char *tzname[2]; HP-UX COMPATIBILITY Level: HP-UX/RUN ONLY Origin: System III 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 following 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 contain- ing the broken-down time. _L_o_c_a_l_t_i_m_e corrects for the time zone and possible daylight savings time; _g_m_t_i_m_e converts directly to GMT, which is the time the HP-UX system 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; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }; These quantities give the time on a 24-hour clock, day of month (1-31), month of year (0-11), day of week (Sunday = 0), year - 1900, day of year (0-365), and a flag that is non-zero if daylight saving time is in effect. The external long variable _t_i_m_e_z_o_n_e contains the difference, in seconds, between GMT and local standard time (in EST, _t_i_m_e_z_o_n_e is 5*60*60); the external variable _d_a_y_l_i_g_h_t is non-zero if and only if the standard U.S.A. Daylight Savings Time conversion should be applied. The program knows about the peculiarities of this conversion in 1974 and 1975; if necessary, a table for these years can be extended. If an environment variable named TZ is present, _a_s_c_t_i_m_e uses the contents of the variable to override the default time zone. The value of TZ must be a three-letter time zone name, followed by a number representing the difference between local time and Greenwich time in hours, followed by an optional three-letter name for a daylight time zone. For example, the setting for New Jersey would be EST5EDT. The effects of setting TZ are thus to change the values of the external variables _t_i_m_e_z_o_n_e and _d_a_y_l_i_g_h_t; in addition, the time zone names contained in the external variable char *tzname[2] = {"EST", "EDT"}; are set from the environment variable. The function _t_z_s_e_t sets the external variables from TZ; it is called by _a_s_c_t_i_m_e and may also be called explicitly by the user. SEE ALSO time(2), getenv(3C), environ(7). BUGS The return values point to static data whose content is overwritten by each call.