This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug manual/5651] New: make clear that users of times() should use sysconf() and not CLOCKS_PER_SECOND


The below patch adds documentation to times() in glibc
texinfo to use sysconf() to get the interval of units in
struct tms, rather than the implied CLOCKS_PER_SECOND.  The
information shown there is misleading, in my opinion, or at
least inadequate.  The patch will bring it into consistency
with the wording found in the system manual pages.

diff -ur glibc.orig/manual/time.texi glibc/manual/time.texi
--- glibc.orig/manual/time.texi 2007-10-27 18:51:07.000000000 -0700
+++ glibc/manual/time.texi      2008-01-19 16:08:17.720022515 -0800
@@ -337,7 +337,11 @@
 @comment POSIX.1
 @deftypefun clock_t times (struct tms *@var{buffer})
 The @code{times} function stores the processor time information for
-the calling process in @var{buffer}.
+the calling process in @var{buffer}.  Although stored with type
+@code{clock_t}, the values are not in @code{CLOCKS_PER_SECOND} units;
+instead, the number of clock ticks per second can be obtained using
+@code{sysconf(_SC_CLK_TCK)}.  Note that this only pertains to the
+values stored in @var{buffer}, not the return value.

 The return value is the calling process' CPU time (the same value you
 get from @code{clock()}.  @code{times} returns @code{(clock_t)(-1)} to

-- 
           Summary: make clear that users of times() should use sysconf()
                    and not CLOCKS_PER_SECOND
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P2
         Component: manual
        AssignedTo: roland at gnu dot org
        ReportedBy: scott dot m dot mcdermott at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=5651

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]