#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 Sep 7, 2017 at 5:40:56 AM 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 Sep 7, 2017 at 5:43:57 AM by Sebastian Huber

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

comment:3 Changed on Sep 15, 2017 at 11:06:07 AM by Sebastian Huber

Resolution: fixed
Status: acceptedclosed

comment:4 Changed on Nov 9, 2017 at 6:27:14 AM by Sebastian Huber

Milestone: 4.12.05.1

Milestone renamed

Note: See TracTickets for help on using tickets.