HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
c
ctime(3C) ctime(3C)
The file /etc/default/tz
contains the timezone value used by tzset()
when
the environment variable
TZ is not set. The format for the file is same as
TZ format
without the prefix
TZ=. Please check environ (5) for
TZ format. The order of TZ set-
ting is as follows.
1) if the environment variable
TZ
is present, it takes precedence.
2) if
TZ is not present, then the value contained in
/etc/default/tz
is used for
the default.
3) if
/etc/default/tz
is not set then the default value is equivalent to
EST5EDT
(Eastern Standard Time) of the USA.
/etc/default/tz
can be modified for an appropriate default value for timezone.
The <
time.h> header file contains declarations of all relevant functions and externals. It also contains
the tm structure, which includes the following members:
int tm_sec; /* seconds after the minute - [0,61] */
int tm_min; /* minutes after the hour - [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; /* years since 1900 */
int tm_wday; /* days since Sunday - [0,6] */
int tm_yday; /* days since January 1 - [0,365] */
int tm_isdst; /* daylight savings time flag */
The value of
tm_isdst is positive if a summer time zone adjustment such as Daylight Savings Time is
in effect, zero if not in effect, and negative if the information is not available.
The external variable
timezone contains the difference, in seconds, between UTC and local standard
time (for example, in the U.S. Eastern time zone (EST), timezone is 5∗60∗60). The external variable
daylight is non-zero only if a summer time zone adjustment is specified in the TZ environment vari-
able. The external variable tzname[2] contains the local standard and local summer time zone abbre-
viations as specified by the TZ environment variable.
EXTERNAL INFLUENCES
Locale
The
LC_CTYPE category determines the interpretation of the bytes within format as single and/or
multi-byte characters.
Environment Variables
The
tzset() function uses the contents of TZ to set the values of the external variables timezone
,
daylight, and tzname. TZ also determines the time zone name substituted for the %Z
and %z
directives and the time zone adjustments performed by localtime(), mktime(), and ctime().Two
methods for specifying a time zone within TZ are described in environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
For
asctime_r() and ctime_r(), if the buffer is of insufficient length, a NULL is returned and
errno set to EINVAL.
asctime_r(), ctime_r(), gmtime_r(), and localtime_r() return a NULL and set errno to
EINVAL if NULL pointers are passed in as arguments.
A NULL is returned and errno is set to
ERANGE if the input to the following routines is not within the
supported range: asctime(), asctime_r(), ctime(), ctime_r(), gmtime(), gmtime_r(),
localtime(), localtime_r().
APPLICATION USAGE
The return values for
asctime(), ctime(), gmtime(), and localtime() point to static data
whose contents is overwritten by each call.
Section 3−−160 Hewlett-Packard Company − 3 − HP-UX 11i Version 2: September 2004