Changeset View
Changeset View
Standalone View
Standalone View
contrib/tzcode/newctime.3
.\" This file is in the public domain, so clarified as of | .\" This file is in the public domain, so clarified as of | ||||
.\" 2009-05-17 by Arthur David Olson. | .\" 2009-05-17 by Arthur David Olson. | ||||
.TH NEWCTIME 3 | .TH newctime 3 "" "Time Zone Database" | ||||
.SH NAME | .SH NAME | ||||
asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time | asctime, ctime, difftime, gmtime, localtime, mktime \- convert date and time | ||||
.SH SYNOPSIS | .SH SYNOPSIS | ||||
.nf | .nf | ||||
.ie \n(.g .ds - \f(CR-\fP | .ie \n(.g .ds - \f(CR-\fP | ||||
.el .ds - \- | .el .ds - \- | ||||
.B #include <time.h> | .B #include <time.h> | ||||
.PP | .PP | ||||
.BR "extern char *tzname[];" " /\(** (optional) \(**/" | .BR "extern char *tzname[];" " /\(** (optional) \(**/" | ||||
.PP | .PP | ||||
.B char *ctime(time_t const *clock); | .B [[deprecated]] char *ctime(time_t const *clock); | ||||
.PP | .PP | ||||
.B char *ctime_r(time_t const *clock, char *buf); | .B char *ctime_r(time_t const *clock, char *buf); | ||||
.PP | .PP | ||||
.B double difftime(time_t time1, time_t time0); | .B double difftime(time_t time1, time_t time0); | ||||
.PP | .PP | ||||
.B char *asctime(struct tm const *tm); | .B [[deprecated]] char *asctime(struct tm const *tm); | ||||
.PP | .PP | ||||
.B "char *asctime_r(struct tm const *restrict tm," | .B "char *asctime_r(struct tm const *restrict tm," | ||||
.B " char *restrict result);" | .B " char *restrict result);" | ||||
.PP | .PP | ||||
.B struct tm *localtime(time_t const *clock); | .B struct tm *localtime(time_t const *clock); | ||||
.PP | .PP | ||||
.B "struct tm *localtime_r(time_t const *restrict clock," | .B "struct tm *localtime_r(time_t const *restrict clock," | ||||
.B " struct tm *restrict result);" | .B " struct tm *restrict result);" | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
The POSIX standard says that timestamps must be nonnegative | The POSIX standard says that timestamps must be nonnegative | ||||
and must ignore leap seconds. | and must ignore leap seconds. | ||||
Many implementations extend POSIX by allowing negative timestamps, | Many implementations extend POSIX by allowing negative timestamps, | ||||
and can therefore represent timestamps that predate the | and can therefore represent timestamps that predate the | ||||
introduction of UTC and are some other flavor of Universal Time (UT). | introduction of UTC and are some other flavor of Universal Time (UT). | ||||
Some implementations support leap seconds, in contradiction to POSIX. | Some implementations support leap seconds, in contradiction to POSIX. | ||||
.PP | .PP | ||||
The | The | ||||
.B ctime | |||||
function is deprecated starting in C23. | |||||
Callers can use | |||||
.B localtime_r | |||||
and | |||||
.B strftime | |||||
instead. | |||||
.PP | |||||
The | |||||
.B localtime | .B localtime | ||||
and | and | ||||
.B gmtime | .B gmtime | ||||
functions | functions | ||||
return pointers to | return pointers to | ||||
.q "tm" | .q "tm" | ||||
structures, described below. | structures, described below. | ||||
The | The | ||||
Show All 21 Lines | |||||
The | The | ||||
.B asctime | .B asctime | ||||
function | function | ||||
converts a time value contained in a | converts a time value contained in a | ||||
.q "tm" | .q "tm" | ||||
structure to a string, | structure to a string, | ||||
as shown in the above example, | as shown in the above example, | ||||
and returns a pointer to the string. | and returns a pointer to the string. | ||||
This function is deprecated starting in C23. | |||||
Callers can use | |||||
.B strftime | |||||
instead. | |||||
.PP | .PP | ||||
The | The | ||||
.B mktime | .B mktime | ||||
function | function | ||||
converts the broken-down time, | converts the broken-down time, | ||||
expressed as local time, | expressed as local time, | ||||
in the structure pointed to by | in the structure pointed to by | ||||
.I tm | .I tm | ||||
▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
will | will | ||||
continue to exist in this form in future releases of this code. | continue to exist in this form in future releases of this code. | ||||
.SH FILES | .SH FILES | ||||
.ta \w'/usr/share/zoneinfo/posixrules\0\0'u | .ta \w'/usr/share/zoneinfo/posixrules\0\0'u | ||||
/usr/share/zoneinfo timezone information directory | /usr/share/zoneinfo timezone information directory | ||||
.br | .br | ||||
/usr/share/zoneinfo/localtime local timezone file | /usr/share/zoneinfo/localtime local timezone file | ||||
.br | .br | ||||
/usr/share/zoneinfo/posixrules used with POSIX-style TZ's | /usr/share/zoneinfo/posixrules default DST rules (obsolete, | ||||
and can cause bugs if present) | |||||
.br | .br | ||||
/usr/share/zoneinfo/GMT for UTC leap seconds | /usr/share/zoneinfo/GMT for UTC leap seconds | ||||
.sp | .sp | ||||
If | If | ||||
.B /usr/share/zoneinfo/GMT | .B /usr/share/zoneinfo/GMT | ||||
is absent, | is absent, | ||||
UTC leap seconds are loaded from | UTC leap seconds are loaded from | ||||
.BR /usr/share/zoneinfo/posixrules . | .BR /usr/share/zoneinfo/posixrules . | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |