|
NAMEasctime , asctime_r ,
ctime , ctime_r ,
difftime , gmtime ,
gmtime_r , localtime ,
localtime_r , mktime ,
timegm —
transform binary date and time values
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <time.h>
extern char *tzname[2]; char *
double
char *
struct tm *
struct tm *
time_t
time_t
char *
struct tm *
struct tm *
char *
DESCRIPTIONThe functionsctime (), 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 After filling in the tm structure,
The function The Thu Nov 24 18:22:48 1986\n\0 All the fields have constant width. The The The The functions 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 their
normal ranges, and will be normalized if needed. For example, October 40 is
changed into November 9, a tm_hour of -1 means 1 hour
before midnight, tm_mday of 0 means the day preceding
the current month, and tm_mon of -2 means 2 months
before January of tm_year. (A positive or zero value
for tm_isdst causes On successful completion, the values of the
tm_wday and tm_yday components
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
until tm_mon and tm_year are
determined. The The External declarations as well as the tm structure definition are
in the 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 timezone 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. SEE ALSOdate(1), gettimeofday(2), getenv(3), time(3), tzset(3), tzfile(5)STANDARDSTheasctime (), ctime (),
difftime (), gmtime (),
localtime (), and mktime ()
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 The HISTORYThis manual page is derived from the time package contributed to Berkeley by Arthur Olson and which appeared in 4.3BSD.The functions The functions BUGSExcept fordifftime (), mktime (),
and the _r () variants of the other functions, these
functions leave 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 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.
Visit the GSP FreeBSD Man Page Interface. |