HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
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-bitHP-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.
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.
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] */
HP-UX Release 11i: December 2000 2 Section 3105
___
___