Point out more explicitly that 'tz' argument should normally be NULL.

Various other minor edits and formatting fixes.
This commit is contained in:
Michael Kerrisk 2006-04-20 21:07:10 +00:00
parent b776661a65
commit 1c382af469
1 changed files with 38 additions and 33 deletions

View File

@ -60,14 +60,14 @@ argument is a
(as specified in
.IR <sys/time.h> ):
.sp
.in +0.25i
.nf
struct timeval {
.in +8
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
.in -8
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
.fi
.in -0.25i
.sp
and gives the number of seconds and microseconds since the Epoch (see
.BR time (2)).
@ -76,16 +76,31 @@ The
argument is a
.IR "struct timezone" :
.sp
.in +0.25i
.nf
struct timezone {
.in +8
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
.in -8
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
.fi
.in -0.25i
.PP
The use of the timezone struct is obsolete: the
If either
.I tv
or
.I tz
is NULL, the corresponding structure is not set or returned.
.\" The following is covered under EPERM below:
.\" .PP
.\" Only the superuser may use
.\" .BR settimeofday ().
.PP
The use of the
.I timezone
structure is obsolete; the
.I tz
argument should normally be specfied as NULL.
The
.I tz_dsttime
field has never been used under Linux; it has not
been and will not be supported by libc or glibc.
@ -102,28 +117,27 @@ it does not indicate that DST is in force, it just selects an
algorithm.)
The daylight saving time algorithms defined are as follows :
.PP
.ta 14
\fB DST_NONE\fP /* not on dst */
\fB DST_NONE\fP /* not on dst */
.br
\fB DST_USA\fP /* USA style dst */
\fB DST_USA\fP /* USA style dst */
.br
\fB DST_AUST\fP /* Australian style dst */
\fB DST_AUST\fP /* Australian style dst */
.br
\fB DST_WET\fP /* Western European dst */
\fB DST_WET\fP /* Western European dst */
.br
\fB DST_MET\fP /* Middle European dst */
\fB DST_MET\fP /* Middle European dst */
.br
\fB DST_EET\fP /* Eastern European dst */
\fB DST_EET\fP /* Eastern European dst */
.br
\fB DST_CAN\fP /* Canada */
\fB DST_CAN\fP /* Canada */
.br
\fB DST_GB\fP /* Great Britain and Eire */
\fB DST_GB\fP /* Great Britain and Eire */
.br
\fB DST_RUM\fP /* Rumania */
\fB DST_RUM\fP /* Rumania */
.br
\fB DST_TUR\fP /* Turkey */
\fB DST_TUR\fP /* Turkey */
.br
\fB DST_AUSTALT\fP /* Australian style with shift in 1986 */
\fB DST_AUSTALT\fP /* Australian style with shift in 1986 */
.PP
Of course it turned out that the period in which
Daylight Saving Time is in force cannot be given
@ -155,28 +169,19 @@ The following macros are defined to operate on a
.IR "struct timeval" :
.sp
.nf
#define timerisset(tvp)\\
#define timerisset(tvp)\\
.ti +8
((tvp)\->tv_sec || (tvp)\->tv_usec)
#define timercmp(tvp, uvp, cmp)\\
#define timercmp(tvp, uvp, cmp)\\
.in +8
((tvp)\->tv_sec cmp (uvp)\->tv_sec ||\\
(tvp)\->tv_sec == (uvp)\->tv_sec &&\\
(tvp)\->tv_usec cmp (uvp)\->tv_usec)
.in -8
#define timerclear(tvp)\\
#define timerclear(tvp)\\
.ti +8
((tvp)\->tv_sec = (tvp)\->tv_usec = 0)
.fi
.PP
If either
.I tv
or
.I tz
is null, the corresponding structure is not set or returned.
.PP
Only the superuser may use
.BR settimeofday ().
.SH "RETURN VALUE"
.BR gettimeofday ()
and