[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#286137: marked as done (glibc-doc: times return vs clock return)



Your message dated Tue, 5 Dec 2017 21:04:11 +0100
with message-id <20171205200411.GA16710@aurel32.net>
and subject line Bug#286137: glibc-doc: times return vs clock return
has caused the Debian Bug report #286137,
regarding glibc-doc: times return vs clock return
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
286137: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=286137
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: glibc-doc
Version: 2.3.2.ds1-19
Severity: normal

In the "Processor Time" node, times() is described with

    The return value is the calling process' CPU time (the same value
    you get from `clock()'.

But I think that's not the case on a Debian system.  For instance,

    #include <stdio.h>
    #include <time.h>
    #include <sys/times.h>
    #include <unistd.h>
    int
    main (void)
    {
      struct tms t;
      printf ("%ld %ld\n", times(&t), clock());
      sleep(1);
      printf ("%ld %ld\n", times(&t), clock());
      return 0;
    }

prints

    430113019 10000
    430113120 10000

times() has increased by 100 for the elapsed 1 second, but clock()
hasn't.

The way the code works corresponds to the posix specs, clock() is cpu
time consumed by the process, but the times() return is real time
(ie. wall clock).


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)
Kernel: Linux 2.6.8-1-386
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

-- no debconf information


--- End Message ---
--- Begin Message ---
Version: 2.16-0experimental1

On 2004-12-18 08:38, Kevin Ryde wrote:
> Package: glibc-doc
> Version: 2.3.2.ds1-19
> Severity: normal
> 
> In the "Processor Time" node, times() is described with
> 
>     The return value is the calling process' CPU time (the same value
>     you get from `clock()'.
> 
> But I think that's not the case on a Debian system.  For instance,
> 
>     #include <stdio.h>
>     #include <time.h>
>     #include <sys/times.h>
>     #include <unistd.h>
>     int
>     main (void)
>     {
>       struct tms t;
>       printf ("%ld %ld\n", times(&t), clock());
>       sleep(1);
>       printf ("%ld %ld\n", times(&t), clock());
>       return 0;
>     }
> 
> prints
> 
>     430113019 10000
>     430113120 10000
> 
> times() has increased by 100 for the elapsed 1 second, but clock()
> hasn't.
> 
> The way the code works corresponds to the posix specs, clock() is cpu
> time consumed by the process, but the times() return is real time
> (ie. wall clock).

This has been fixed in version 2.16, in upstream commit 4cfd80263af2.
Closing the bug.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: