#3121 closed defect (fixed)

clock() implementation in Newlib is broken

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: tool/newlib Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Newlib uses _times_r() in clock(). The problem is that the _times_r() clock frequency is defined by sysconf(_SC_CLK_TCK). The clock frequency of clock() is the constant CLOCKS_PER_SEC.

FreeBSD uses getrusage() for clock().

Change History (4)

comment:1 Changed on 09/07/17 at 05:40:56 by Sebastian Huber <sebastian.huber@…>

In bdbf1ffa/rtems:

Implement clock()

Newlib uses _times_r() in clock(). The problem is that the _times_r()
clock frequency is defined by sysconf(_SC_CLK_TCK). The clock frequency
of clock() is the constant CLOCKS_PER_SEC.

FreeBSD uses getrusage() for clock(). Since RTEMS has only one process,
the implementation can be simplified.

Update #3121.

comment:2 Changed on 09/07/17 at 05:43:57 by Sebastian Huber

Milestone: Indefinite4.12.0
Owner: changed from joel.sherrill@… to Sebastian Huber
Status: newaccepted

comment:3 Changed on 09/15/17 at 11:06:07 by Sebastian Huber

Resolution: fixed
Status: acceptedclosed

comment:4 Changed on 11/09/17 at 06:27:14 by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.