2.11BSD/man/cat3/asctime.0

Compare this file to the similar file:
Show the results in this format:




CTIME(3)	    UNIX Programmer's Manual		 CTIME(3)



NAME
     ctime, localtime, gmtime, asctime, timezone, tzset -  con-
     vert date and time to ASCII

SYNOPSIS
     void tzset()

     char *ctime(clock)
     time_t *clock;

     #include <time.h>

     char *asctime(tm)
     struct tm *tm;

     struct tm *localtime(clock)
     time_t *clock;

     struct tm *gmtime(clock)
     time_t *clock;

     char *timezone(zone, dst)

DESCRIPTION
     _T_z_s_e_t uses the value of the environment variable TZ to set
     up the time conversion information used by _l_o_c_a_l_t_i_m_e.

     If TZ does not appear in the environment, the TZDEFAULT file
     (as defined in _t_z_f_i_l_e._h) is used by _l_o_c_a_l_t_i_m_e.  If this file
     fails for any reason, the GMT offset as provided by the ker-
     nel is used.  In this case, DST is ignored, resulting in the
     time being incorrect by some amount if DST is currently in
     effect.  If this fails for any reason, GMT is used.

     If TZ appears in the environment but its value is a null
     string, Greenwich Mean Time is used; if TZ appears and
     begins with a slash, it is used as the absolute pathname of
     the _t_z_f_i_l_e(5)-format file from which to read the time
     conversion information; if TZ appears and begins with a
     character other than a slash, it's used as a pathname rela-
     tive to the system time conversion information directory,
     defined as TZDIR in the include file _t_z_f_i_l_e._h.  If this file
     fails for any reason, GMT is used.

     Programs that always wish to use local wall clock time
     should explicitly remove the environmental variable TZ with
     _u_n_s_e_t_e_n_v(3).

     _C_t_i_m_e converts a long integer, 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.



Printed 11/26/99	November 27, 1996			1






CTIME(3)	    UNIX Programmer's Manual		 CTIME(3)



	 Sun Sep 16 01:03:52 1973\n

     _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 UNIX uses.  _A_s_c_t_i_m_e con-
     verts 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 */
	       char **tm_zone;	       /* abbreviation of timezone name */
	       long tm_gmtoff;	       /* offset from GMT in seconds */
	  };

     _T_m__i_s_d_s_t is non-zero if a time zone adjustment such as Day-
     light Savings time is in effect.

     _T_m__g_m_t_o_f_f is the offset (in seconds) of the time represented
     from GMT, with positive values indicating East of Greenwich.

     _T_i_m_e_z_o_n_e remains for compatibility reasons only; it's impos-
     sible to reliably map timezone's arguments (_z_o_n_e, a "minutes
     west of GMT" value and _d_s_t, a "daylight saving time in
     effect" flag) to a time zone abbreviation.

     If the environmental string _T_Z_N_A_M_E exists, _t_i_m_e_z_o_n_e returns
     its value, unless it consists of two comma separated
     strings, in which case the second string is returned if _d_s_t
     is non-zero, else the first string.  If _T_Z_N_A_M_E doesn't
     exist, _z_o_n_e is checked for equality with a built-in table of
     values, in which case _t_i_m_e_z_o_n_e returns the time zone or day-
     light time zone abbreviation associated with that value.  If
     the requested _z_o_n_e does not appear in the table, the differ-
     ence from GMT is returned; 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 returned.	Programs that in
     the past used the _t_i_m_e_z_o_n_e function should return the zone
     name as set by _l_o_c_a_l_t_i_m_e to assure correctness.

FILES
     /usr/share/zoneinfotime zone information directory



Printed 11/26/99	November 27, 1996			2






CTIME(3)	    UNIX Programmer's Manual		 CTIME(3)



     /etc/localtime	local time zone file

SEE ALSO
     gettimeofday(2), getenv(3), time(3), tzfile(5), environ(7)

NOTE
     The return values point to static data whose content is
     overwritten by each call.	The tm_zone field of a returned
     struct tm points to a static array of characters, which will
     also be overwritten at the next call (and by calls to
     _t_z_s_e_t).












































Printed 11/26/99	November 27, 1996			3