diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-21 20:03:32 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-21 20:03:32 +0000 |
commit | f895e2fefee423d37285d8af1697c7f91d211aed (patch) | |
tree | 9db871d9fe9c12f9ff793291d089ef3256e690e5 /nuttx/sched | |
parent | 038192c8c108c106ee6b5d918eabc0c0274b14fa (diff) | |
download | px4-nuttx-f895e2fefee423d37285d8af1697c7f91d211aed.tar.gz px4-nuttx-f895e2fefee423d37285d8af1697c7f91d211aed.tar.bz2 px4-nuttx-f895e2fefee423d37285d8af1697c7f91d211aed.zip |
timer_gettime was not returning the right value for it_interval
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@116 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/timer_gettime.c | 2 | ||||
-rw-r--r-- | nuttx/sched/timer_internal.h | 1 | ||||
-rw-r--r-- | nuttx/sched/timer_settime.c | 2 |
3 files changed, 4 insertions, 1 deletions
diff --git a/nuttx/sched/timer_gettime.c b/nuttx/sched/timer_gettime.c index 91a5a60d0..26499555c 100644 --- a/nuttx/sched/timer_gettime.c +++ b/nuttx/sched/timer_gettime.c @@ -114,7 +114,7 @@ int timer_gettime(timer_t timerid, FAR struct itimerspec *value) /* Convert that to a struct timespec and return it */ (void)clock_ticks2time(ticks, &value->it_value); - (void)clock_ticks2time(timer->pt_delay, &value->it_interval); + (void)clock_ticks2time(timer->pt_last, &value->it_interval); return OK; } diff --git a/nuttx/sched/timer_internal.h b/nuttx/sched/timer_internal.h index 1c1e8ec54..604adbc8e 100644 --- a/nuttx/sched/timer_internal.h +++ b/nuttx/sched/timer_internal.h @@ -65,6 +65,7 @@ struct posix_timer_s ubyte pt_signo; /* Notification signal */ pid_t pt_owner; /* Creator of timer */ int pt_delay; /* If non-zero, used to reset repetitive timers */ + int pt_last; /* Last value used to set watchdog */ WDOG_ID pt_wdog; /* The watchdog that provides the timing */ union sigval pt_value; /* Data passed with notification */ }; diff --git a/nuttx/sched/timer_settime.c b/nuttx/sched/timer_settime.c index fda730f9b..29796a593 100644 --- a/nuttx/sched/timer_settime.c +++ b/nuttx/sched/timer_settime.c @@ -139,6 +139,7 @@ static void inline timer_restart(FAR struct posix_timer_s *timer, uint32 itimer) if (timer->pt_delay) { + timer->pt_last = timer->pt_delay; (void)wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, itimer); } } @@ -353,6 +354,7 @@ int timer_settime(timer_t timerid, int flags, FAR const struct itimerspec *value if (delay > 0) { + timer->pt_last = delay; ret = wd_start(timer->pt_wdog, timer->pt_delay, timer_timeout, 1, (uint32)timer); } |