ctime.3c (2010 09)

c
ctime(3C) ctime(3C)
the user.
When the environment variable
TZ is not set,
tzset() checks the default file
/etc/default/tz
for the timezone value and sets timezone values based on that.
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.
If the value of the timezone cannot be determined using the environment variable
TZ
or the file /etc/default/tz
, it is set to the default value of EST5EDT. If the
timezone is set to the default value of EST5EDT and the timezone adjustment file is
not available, the timezone is set to a default value of UTC (Coordinated Universal
Time).
/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 direc-
tives 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 multibyte 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.
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3