Manual Pages for UNIX Darwin command on man asctime
MyWebUniversity

Manual Pages for UNIX Darwin command on man asctime

CTIME(3) BSD Library Functions Manual CTIME(3)

NAME

aassccttiimmee, aassccttiimmeerr, ccttiimmee, ccttiimmeerr, ddiiffffttiimmee, ggmmttiimmee, ggmmttiimmeerr,

llooccaallttiimmee, llooccaallttiimmeerr, mmkkttiimmee, ttiimmeeggmm - transform binary date and time

values LLIIBBRRAARRYY

Standard C Library (libc, -lc)

SYNOPSIS

##iinncclluuddee <>

extern char *tzname[2]; char * ccttiimmee(const timet *clock); double ddiiffffttiimmee(timet time1, timet time0); char * aassccttiimmee(const struct tm *tm); struct tm * llooccaallttiimmee(const timet *clock); struct tm * ggmmttiimmee(const timet *clock); timet mmkkttiimmee(struct tm *tm); timet ttiimmeeggmm(struct tm *tm); char * ccttiimmeerr(const timet *clock, char *buf); struct tm * llooccaallttiimmeerr(const timet *clock, struct tm *result); struct tm * ggmmttiimmeerr(const timet *clock, struct tm *result); char * aassccttiimmeerr(const struct tm *tm, char *buf);

DESCRIPTION

The functions ccttiimmee(), ggmmttiimmee() and llooccaallttiimmee() all take as an argument a time value representing the time in seconds since the Epoch (00:00:00 UTC, January 1, 1970; see time(3)). The function llooccaallttiimmee() converts the time value pointed at by clock, and returns a pointer to a ``struct tm'' (described below) which contains the

broken-out time information for the value after adjusting for the current

time zone (and any other factors such as Daylight Saving Time). Time

zone adjustments are performed as specified by the TZ environment vari-

able (see tzset(3)). The function llooccaallttiimmee() uses tzset(3) to initial-

ize time conversion information if tzset(3) has not already been called by the process.

After filling in the tm structure, llooccaallttiimmee() sets the tmisdst'th ele-

ment of tzname to a pointer to an ASCII string that's the time zone abbreviation to be used with llooccaallttiimmee()'s return value. The function ggmmttiimmee() similarly converts the time value, but without any time zone adjustment, and returns a pointer to a tm structure (described below). The ccttiimmee() function adjusts the time value for the current time zone in

the same manner as llooccaallttiimmee(), and returns a pointer to a 26-character

string of the form: Thu Nov 24 18:22:48 1986\n\0 All the fields have constant width. The ccttiimmeerr() function provides the same functionality as ccttiimmee() except the caller must provide the output buffer buf to store the result, which must be at least 26 characters long. The llooccaallttiimmeerr() and ggmmttiimmeerr() functions provide the same functionality as llooccaallttiimmee() and ggmmttiimmee() respectively, except the caller must provide the output buffer result. The aassccttiimmee() function converts the broken down time in the structure tm pointed at by *tm to the form shown in the example above. The aassccttiimmeerr() function provides the same functionality as aassccttiimmee() except the caller provide the output buffer buf to store the result, which must be at least 26 characters long.

The functions mmkkttiimmee() and ttiimmeeggmm() convert the broken-down time in the

structure pointed to by tm into a time value with the same encoding as that of the values returned by the time(3) function (that is, seconds

from the Epoch, UTC). The mmkkttiimmee() function interprets the input struc-

ture according to the current timezone setting (see tzset(3)). The

ttiimmeeggmm() function interprets the input structure as representing Univer-

sal Coordinated Time (UTC).

The original values of the tmwday and tmyday components of the struc-

ture are ignored, and the original values of the other components are not restricted to their normal ranges, and will be normalized if needed. For

example, October 40 is changed into November 9, a tmhour of -1 means 1

hour before midnight, tmmday of 0 means the day preceding the current

month, and tmmon of -2 means 2 months before January of tmyear. (A

positive or zero value for tmisdst causes mmkkttiimmee() to presume initially that summer time (for example, Daylight Saving Time) is or is not in effect for the specified time, respectively. A negative value for tmisdst causes the mmkkttiimmee() function to attempt to divine whether summer time is in effect for the specified time. The tmisdst and tmgmtoff members are forced to zero by ttiimmeeggmm().)

On successful completion, the values of the tmwday and tmyday compo-

nents of the structure are set appropriately, and the other components are set to represent the specified calendar time, but with their values forced to their normal ranges; the final value of tmmday is not set until tmmon and tmyear are determined. The mmkkttiimmee() function returns the specified calendar time; if the calendar time cannot be represented,

it returns -1;

The ddiiffffttiimmee() function returns the difference between two calendar

times, (time1 - time0), expressed in seconds.

External declarations as well as the tm structure definition are in the include file. The tm structure includes at least the following fields:

int tmsec; /* seconds (0 - 60) */

int tmmin; /* minutes (0 - 59) */

int tmhour; /* hours (0 - 23) */

int tmmday; /* day of month (1 - 31) */

int tmmon; /* month of year (0 - 11) */

int tmyear; /* year - 1900 */

int tmwday; /* day of week (Sunday = 0) */

int tmyday; /* day of year (0 - 365) */

int tmisdst; /* is summer time in effect? */ char *tmzone; /* abbreviation of timezone name */ long tmgmtoff; /* offset from UTC in seconds */

The field tmisdst is non-zero if summer time is in effect.

The field tmgmtoff is the offset (in seconds) of the time represented from UTC, with positive values indicating east of the Prime Meridian.

SEE ALSO

date(1), gettimeofday(2), getenv(3), time(3), tzset(3), tzfile(5) STANDARDS The aassccttiimmee(), ccttiimmee(), ddiiffffttiimmee(), ggmmttiimmee(), llooccaallttiimmee(), and mmkkttiimmee() functions conform to ISO/IEC 9899:1990 (``ISO C90''), and conform to

ISO/IEC 9945-1:1996 (``POSIX.1'') provided the selected local timezone

does not contain a leap-second table (see zic(8)).

The aassccttiimmeerr(), ccttiimmeerr(), ggmmttiimmeerr(), and llooccaallttiimmeerr() functions are

expected to conform to ISO/IEC 9945-1:1996 (``POSIX.1'') (again provided

the selected local timezone does not contain a leap-second table).

The ttiimmeeggmm() function is not specified by any standard; its function can-

not be completely emulated using the standard functions described above. HISTORY This manual page is derived from the time package contributed to Berkeley by Arthur Olson and which appeared in 4.3BSD.

BUGS

Except for ddiiffffttiimmee(), mmkkttiimmee(), and the rr() variants of the other func-

tions, these functions leaves their result in an internal static object and return a pointer to that object. Subsequent calls to these function will modify the same object. The C Standard provides no mechanism for a program to modify its current

local timezone setting, and the POSIX-standard method is not reentrant.

(However, thread-safe implementations are provided in the POSIX threaded

environment.) The tmzone field of a returned tm structure points to a static array of characters, which will also be overwritten by any subsequent calls (as well as by subsequent calls to tzset(3) and tzsetwall(3)). Use of the external variable tzname is discouraged; the tmzone entry in the tm structure is preferred. BSD January 2, 1999 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™