#1296 closed defect (fixed)

POSIX timers use incorrect repeat interval.

Reported by: Tim FitzGeorge Owned by: Joel Sherrill
Priority: normal Milestone: 4.9
Component: score Version: 4.9
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The POSIX specification for timer_settime() states that a timer uses value.it_value for the initial timeout period and value.it_interval for the repeat period. The code in timersettime.c (4.9) and ptimer1.c (4.8) uses value.it_value for both.

The code checks value.it_interval , and if it is non-zero sets the timer as a repeating timer, but uses timer.it_value for the period.

The current code (from timersettime.c)


ptimer->ticks = _Timespec_To_ticks( &normalize.it_value );


activated = _POSIX_Timer_Insert_helper(

&ptimer->Timer,
ptimer->ticks,
ptimer->Object.id,
_POSIX_Timer_TSR,
ptimer

);


should be something like:


ticks = _Timespec_To_ticks( &normalize.it_value );
ptimer->ticks = _Timespec_To_ticks( &value->it_interval );


activated = _POSIX_Timer_Insert_helper(

&ptimer->Timer,
ticks,
ptimer->Object.id,
_POSIX_Timer_TSR,
ptimer

);


The code for 4.8 needs a similar change for both absolute and relative timers.

In addition a test case needs to be created. A possibility would be modifying psxtimer.c to use double the repeat period for the initial delay.

Attachments (3)

psxtimer.c (2.8 KB) - added by Tim FitzGeorge on Aug 18, 2008 at 6:34:41 PM.
Test case for bug.
patch-rtems_head-timer_settime.txt (7.9 KB) - added by Tim FitzGeorge on Aug 18, 2008 at 7:54:43 PM.
Patch for HEAD
patch-rtems_4_8_branch-timer_settime.txt (6.3 KB) - added by Tim FitzGeorge on Aug 19, 2008 at 8:48:13 PM.
Patch for rtems-4-8-branch

Download all attachments as: .zip

Change History (4)

Changed on Aug 18, 2008 at 6:34:41 PM by Tim FitzGeorge

Attachment: psxtimer.c added

Test case for bug.

Changed on Aug 18, 2008 at 7:54:43 PM by Tim FitzGeorge

Patch for HEAD

Changed on Aug 19, 2008 at 8:48:13 PM by Tim FitzGeorge

Patch for rtems-4-8-branch

comment:1 Changed on Aug 20, 2008 at 12:29:59 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

See PR1298 to track the issue for timers in the past

http://www.rtems.org/bugzilla/show_bug.cgi?id=1298

Note: See TracTickets for help on using tickets.