asctime man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]

CTIME(3)		    BSD Programmer's Manual		      CTIME(3)

NAME
     asctime, asctime_r, ctime, ctime_r, difftime, gmtime, gmtime_r,
     localtime, localtime_r, mktime - transform binary date and time value to
     ASCII

SYNOPSIS
     #include <time.h>

     extern char *tzname[2];

     char *
     ctime(const time_t *clock);

     char *
     ctime_r(const time_t *clock, char *result);

     double
     difftime(time_t time1, time_t time0);

     char *
     asctime(const struct tm *tm);

     char *
     asctime_r(const struct tm *tm, char *result);

     struct tm *
     localtime(const time_t *clock);

     struct tm *
     localtime_r(const time_t *clock, struct tm *result);

     struct tm *
     gmtime(const time_t *clock);

     struct tm *
     gmtime_r(const time_t *clock, struct tm *result);

     time_t
     mktime(struct tm *tm);

DESCRIPTION
     The functions ctime(), gmtime() and localtime() 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 localtime() 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 environmental vari-
     able (see tzset(3)).  The function localtime() uses tzset to initialize
     time conversion information if tzset has not already been called by the
     process.

     After filling in the tm structure, localtime() sets the tm_isdst'th ele-
     ment of tzname to a pointer to an ASCII string that's the time zone ab-
     breviation to be used with localtime()'s return value.

     The function gmtime() similarly converts the time value, but without any
     time zone adjustment, and returns a pointer to a tm structure (described
     below).

     The ctime() function adjusts the time value for the current time zone in
     the same manner as localtime(), 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 asctime() function converts the broken down time in the structure tm
     pointed at by *tm to the form shown in the example above.

     The function mktime() converts the broken-down time, expressed as local
     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 original values of the tm_wday and tm_yday components of the struc-
     ture are ignored, and the original values of the other components are not
     restricted to their normal ranges.	 (A positive or zero value for
     tm_isdst causes mktime() to presume initially that summer time (for exam-
     ple, Daylight Saving Time) is or is not in effect for the specified time,
     respectively.  A negative value for tm_isdst causes the mktime() function
     to attempt to divine whether summer time is in effect for the specified
     time.)

     On successful completion, the values of the tm_wday and tm_yday 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 tm_mday is not set un-
     til tm_mon and tm_year are determined.  Mktime() returns the specified
     calendar time; if the calendar time cannot be represented, it returns -1;

     The difftime() 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
     <time.h> include file.  The tm structure includes at least the following
     fields:

	   int tm_sec;	   /* seconds (0 - 60) */
	   int tm_min;	   /* minutes (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;	   /* year - 1900 */
	   int tm_wday;	   /* day of week (Sunday = 0) */
	   int tm_yday;	   /* day of year (0 - 365) */
	   int tm_isdst;   /* is summer time in effect? */
	   char *tm_zone;  /* abbreviation of time zone name */
	   long tm_gmtoff; /* offset from UTC in seconds */

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

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

     The r-suffixed variants asctime_r(), ctime_r(), gmtime_r(), and
     localtime_r() are reentrant versions of the corresponding functions.  In-
     stead of using a static local variable, they require a pointer into which
     the result will be stored.	 The return value is always the same as the
     result argument.  For the asctime_r() and ctime_r() functions, the sup-
     plied buffer must be at least 26 bytes long.

SEE ALSO
     date(1),  gettimeofday(2),	 getenv(3),  time(3),  tzset(3),  tzfile(5)

HISTORY
     This manual page is derived from the time package contributed to Berkeley
     by Arthur Olsen and which appeared in 4.3BSD.

STANDARDS
     The asctime_r(), ctime_r(), gmtime_r(), and localtime_r() functions con-
     form to IEEE Std1003.1-1996 (``POSIX'').

BUGS
     Except for difftime() and mktime(), these functions leaves their result
     in an internal static object and return a pointer to that object. Subse-
     quent calls to these function will modify the same object.

     The tm_zone 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 tm_zone entry in
     the tm structure is preferred.

     Avoid using out-of-range values with mktime() when setting up lunch with
     promptness sticklers in Riyadh.

4.3 Berkeley Distribution	 June 4, 1993				     3
[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net