HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
c
ctime(3C) ctime(3C)
The minimum date supported by gmtime() in both 32-bit and 64-bit HP-UX is Friday
December 13 20:45:52 UTC 1901. The maximum dates supported by
gmtime() are
Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC 9999 in
32-bit HP-UX and 64-bit HP-UX, respectively.
In 64-bit HP-UX,
gmtime() returns NULL and sets errno to [ERANGE] if timer is less
than the number of seconds that corresponds to the minimum date supported (i.e.,
INT_MIN, as defined in
limits.h), or exceeds the number of seconds that
corresponds to the maximum date supported.
gmtime_r() is identical to gmtime() , except that
gmtime_r() stores the result in the tm
struct
pointed to by result and returns result
upon success.
localtime() Correct for the time zone and any summer time zone adjustments (such as Daylight
Savings Time in the USA), according to the contents of the TZ environment variable (see
Environment Variables below).
localtime() returns a pointer to the tm structure
described below.
The minimum date supported by
localtime() in both 32-bit and 64-bit HP-UX is
Friday December 13 20:45:52 UTC 1901. The maximum dates supported by
local-
time()
are Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59
UTC 9999 in 32-bit HP-UX and 64-bit HP-UX, respectively.
In 64-bit HP-UX, localtime() returns NULL and sets errno to [ERANGE] if timer
is less than the number of seconds that corresponds to the minimum date supported
(i.e., INT_MIN, as defined in limits.h), or exceeds the number of seconds that
corresponds to the maximum date supported.
localtime_r()
is identical to localtime() , except that localtime_r()
stores the result in the
tm struct pointed to by result and returns result upon success.
difftime() Return the difference in seconds between two calendar times: time1 - time0.
mktime() Convert the broken-down time (expressed as local time) in the structure pointed to by
timeptr into a calendar time value with the same encoding as that of the values
returned by time(2). The original values of the tm_wday and tm_yday components
of the structure are ignored, and the original values of the other components are not
restricted to the ranges indicated below.
A positive or zero value for tm_isdst causes mktime() to initially presume that
Daylight Saving Time respectively is or is not in effect for the specified time. A negative
value for tm_isdst causes mktime() to attempt to determine whether Daylight
Saving Time is in effect for the specified time.
Upon successful completion, all the components are set to represent the specified calen-
dar time, but with their values forced to the ranges indicated below. The final value of
tm_mday is not set until tm_mon and tm_year are determined. mktime()
returns the specified calendar time encoded as a value of type time_t.
The minimum date supported by
mktime() in both 32-bit and 64-bit HP-UX is Friday
December 13 20:45:52 UTC 1901. The maximum dates supported by mktime() are
Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC 9999 in
32-bit HP-UX and 64-bit HP-UX, respectively.
If the calendar time cannot be represented, the function returns the value (time_t)—
1 and sets errno to [ERANGE]. Note the value (time_t) — 1 also corresponds to the
time 23:59:59 on Dec 31, 1969 (plus or minus time zone and Daylight Saving Time
adjustments). Thus it is necessary to check both the return value and errno to reli-
ably detect an error condition.
tzset() Sets the values of the external variables timezone, daylight, and tzname according to
the contents of the TZ environment variable (independent of any time value). The
functions localtime() , mktime(), ctime(), asctime() , and strftime()
(see strftime(3C)) call tzset() and use the values returned in the external variables
described below for their operations. tzset() can also be called directly by 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.
Section 3−−106 Hewlett-Packard Company − 2 − HP-UX 11i Version 1: September 2005