home *** CD-ROM | disk | FTP | other *** search
-
-
-
- NEWCTIME(3) C LIBRARY FUNCTIONS NEWCTIME(3)
-
-
-
- NAME
- ctime, localtime, gmtime, asctime, tzset, tzsetwall - con-
- vert date and time to ASCII
-
- SYNOPSIS
- extern char *tzname[2];
-
- void tzset()
-
- void tzsetwall()
-
- char *ctime(clock)
- long *clock;
-
- #include <time.h>
-
- char *asctime(tm)
- struct tm *tm;
-
- struct tm *localtime(clock)
- long *clock;
-
- struct tm *gmtime(clock)
- long *clock;
-
- cc ... -lz
-
- DESCRIPTION
- _T_z_s_e_t uses the value of the environment variable TZ to set
- time conversion information used by _l_o_c_a_l_t_i_m_e. If TZ does
- not appear in the environment, the best available approxima-
- tion to local wall clock time is used by _l_o_c_a_l_t_i_m_e. 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 relative to a system
- time conversion information directory.
-
- _T_z_s_e_t_w_a_l_l sets things up so that _l_o_c_a_l_t_i_m_e returns the best
- available approximation of local wall clock time.
-
- _C_t_i_m_e converts a long integer, pointed to by _c_l_o_c_k,
- representing the time in seconds since 00:00:00 GMT, January
- 1, 1970, and returns a pointer to a 26-character string of
- the form
- Thu Nov 24 18:22:48 1986\n\0
- All the fields have constant width.
-
- _L_o_c_a_l_t_i_m_e and _g_m_t_i_m_e return pointers to ``tm'' structures,
- described below. _L_o_c_a_l_t_i_m_e corrects for the time zone and
-
-
-
- Sun Release 4.0 Last change: 1
-
-
-
-
-
-
- NEWCTIME(3) C LIBRARY FUNCTIONS NEWCTIME(3)
-
-
-
- any time zone adjustments (such as Daylight Savings time in
- the U.S.A.). Before doing so, _l_o_c_a_l_t_i_m_e calls _t_z_s_e_t (if
- _t_z_s_e_t has not been called in the current process). After
- filling in the ``tm'' structure, _l_o_c_a_l_t_i_m_e sets the
- tm_isdst'th element of tzname to a pointer to an ASCII
- string that's the time zone abbreviation to be used with
- _l_o_c_a_l_t_i_m_e's return value.
-
- _G_m_t_i_m_e converts to Greenwich Mean Time (GMT).
-
- _A_s_c_t_i_m_e converts a time value contained in a ``tm'' struc-
- ture to a 26-character string, as shown in the above exam-
- ple, and returns a pointer to the string.
-
- Declarations of all the functions and externals, and the
- ``tm'' structure, are in the <time.h> header file. The
- structure (of type) struct tm includes the following fields:
-
- int tm_sec; /* seconds (0 - 59) */
- int tm_min; /* minutes (0 - 59) */
- int tm_hour; /* hours (0 - 23) */
- int tm_mday; /* day of month (1 - 31) */
- int tm_mon; /* month of year (0 - 11) */
- int tm_year; /* year - 1900 */
- int tm_wday; /* day of week (Sunday = 0) */
- int tm_yday; /* day of year (0 - 365) */
- int tm_isdst; /* is DST in effect? */
- char *tm_zone; /* abbreviation of timezone name */
- long tm_gmtoff; /* offset from GMT in seconds */
-
- The _t_m__z_o_n_e and _t_m__g_m_t_o_f_f fields exist, and are filled in,
- only if arrangements to do so were made when the library
- containing these functions was created. There is no guaran-
- tee that these fields will continue to exist in this form in
- future releases of this code.
-
- _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.
-
- FILES
- /etc/zoneinfo time zone information directory
- /etc/zoneinfo/localtime local time zone file
-
- SEE ALSO
- tzfile(5), getenv(3), time(2)
-
- NOTE
- The return values point to static data whose content is
- overwritten by each call. The tm_zone field of a returned
-
-
-
- Sun Release 4.0 Last change: 2
-
-
-
-
-
-
- NEWCTIME(3) C LIBRARY FUNCTIONS NEWCTIME(3)
-
-
-
- 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
- or _t_z_s_e_t_w_a_l_l).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sun Release 4.0 Last change: 3
-
-
-
-