Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#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 08/18/08 at 18:34:41.
Test case for bug.
patch-rtems_head-timer_settime.txt (7.9 KB) - added by Tim FitzGeorge on 08/18/08 at 19:54:43.
Patch for HEAD
patch-rtems_4_8_branch-timer_settime.txt (6.3 KB) - added by Tim FitzGeorge on 08/19/08 at 20:48:13.
Patch for rtems-4-8-branch

Download all attachments as: .zip

Change History (4)

Changed on 08/18/08 at 18:34:41 by Tim FitzGeorge

Attachment: psxtimer.c added

Test case for bug.

Changed on 08/18/08 at 19:54:43 by Tim FitzGeorge

Patch for HEAD

Changed on 08/19/08 at 20:48:13 by Tim FitzGeorge

Patch for rtems-4-8-branch

comment:1 Changed on 08/20/08 at 12:29:59 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.