time.7: Mention clock_gettime()/clock_settime() rather than [gs]ettimeofday()

gettimeofday() is declared obsolete by POSIX. Mention instead
the modern APIs for working with the realtime clock.

See https://bugzilla.kernel.org/show_bug.cgi?id=199049

Reported-by: Enrique Garcia <cquike@arcor.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-03-09 08:57:45 +01:00
parent 8f8b643d85
commit 39ad46695f
1 changed files with 7 additions and 4 deletions

View File

@ -130,15 +130,18 @@ UNIX systems represent time in seconds since the
.PP .PP
A program can determine the A program can determine the
.I "calendar time" .I "calendar time"
using via the
.BR gettimeofday (2), .BR clock_gettime (2)
which returns time (in seconds and microseconds) that have .BR CLOCK_REALTIME
clock,
which returns time (in seconds and nanoseconds) that have
elapsed since the Epoch; elapsed since the Epoch;
.BR time (2) .BR time (2)
provides similar information, but only with accuracy to the provides similar information, but only with accuracy to the
nearest second. nearest second.
The system time can be changed using The system time can be changed using
.BR settimeofday (2). .BR clock_settime (2).
.\"
.SS Broken-down time .SS Broken-down time
Certain library functions use a structure of Certain library functions use a structure of
type type