]> git.ipfire.org Git - thirdparty/man-pages.git/commit - man2/times.2
times.2: Recommend clock_gettime(2) as alternative to times(2)
authorThomas Habets <thomas@habets.se>
Mon, 22 Oct 2012 12:59:56 +0000 (14:59 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Wed, 24 Oct 2012 12:54:20 +0000 (14:54 +0200)
commitff393a5f0d0e2de7385e13b9f815749651315ba1
treea6df76785282f23c1494ec2de2c7621f1b610807
parent1959393715deb2f3537b47d6cee41d3b667e1168
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 <mtk.manpages@gmail.com>
man2/times.2