HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)

c
ctime(3C) ctime(3C)
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 56060). 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.
WARNINGS
Users of
asctime_r(), ctime_r(), gmtime_r(), and localtime_r() should also note that these
functions now conform to POSIX.1c. The old prototypes of these functions are supported for compatibility
with existing DCE applications only.
The range of
tm_sec([0,61]) extends to 61 to allow for the occasional one or two leap seconds. How-
ever, the ‘‘seconds since the Epoch’’ value returned by time(2) and passed as the timer argument does not
Section 3148 Hewlett-Packard Company 3 HP-UX 11i Version 2: August 2003