From ff393a5f0d0e2de7385e13b9f815749651315ba1 Mon Sep 17 00:00:00 2001 From: Thomas Habets Date: Mon, 22 Oct 2012 14:59:56 +0200 Subject: [PATCH] times.2: Recommend clock_gettime(2) as alternative to times(2) Recommend clock_gettime(2), not gettimeofday(2) as alternative to times(2). From times(2): "To measure changes in elapsed time, use gettimeofday(2) instead." From gettimeofday(2): "POSIX.1-2008 marks gettimeofday() as obsolete, recommending the use of clock_gettime(2) instead." Some context, showing how use of gettimeofday() causes actual bugs (also read comments): http://blog.habets.pp.se/2010/09/gettimeofday-should-never-be-used-to-measure-time Signed-off-by: Michael Kerrisk --- man2/times.2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man2/times.2 b/man2/times.2 index a37874eb4..24351fed1 100644 --- a/man2/times.2 +++ b/man2/times.2 @@ -35,7 +35,7 @@ .\" Added notes on nonstandard behavior: Linux allows 'buf' to .\" be NULL, but POSIX.1 doesn't specify this and it's nonportable. .\" -.TH TIMES 2 2012-04-16 "Linux" "Linux Programmer's Manual" +.TH TIMES 2 2012-10-22 "Linux" "Linux Programmer's Manual" .SH NAME times \- get process times .SH SYNOPSIS @@ -174,7 +174,7 @@ combined with the fact that the returned value may overflow the range of .IR clock_t , means that a portable application would be wise to avoid using this value. To measure changes in elapsed time, use -.BR gettimeofday (2) +.BR clock_gettime (2) instead. .\" .PP .\" On older systems the number of clock ticks per second is given