Odd Time of Day Reported with Ticker
Joel Sherrill
joel at rtems.org
Tue Jan 19 14:39:42 UTC 2016
On Jan 19, 2016 3:53 AM, "Sebastian Huber" <
sebastian.huber at embedded-brains.de> wrote:
>
> The problem is that you set the time via rtems_clock_set() in Init(). The
you wait via rtems_task_wake_after(5s in ticks). With a
rtems_task_wake_after(n) you wait to the n-th next tick, thus your wait
interval is slightly less than 5s in most cases.
That makes sense but it unfortunately makes the obvious explanation of
ticker a bit more complicated. :)
0: RTEMS starts
0+t1: clock_set to TIME
0+t[234]: three wake afters
500th clock tick is now exactly five seconds from time 0 but TIME+5 seconds
minus t1 clock time.
The thing that surprised me was that when I hacked in changes to use
rtems_clock_get_tod_timeval(), the times do not indicate that 5 seconds of
delay actually occurred.
TA1 599562000:1088
TA2 599562000:2143
TA3 599562000:3199
TA1 599562004:997954
TA2 599562009:977896
TA1 599562009:978937
TA3 599562014:957903
TA1 599562014:958944
TA2 599562019:957907
The tasks are delaying 500, 1000, and 1500 ticks with nanoseconds_per_tick
= 10000000. Delay operations are guaranteed to be a minimum of the
requested amount and this is not being honored.
I know this is a duration specified in clock ticks but it is really (ticks
* nanoseconds per tick) long in real time.
I have not checked delays like sleep() and nanosleep() but tick based ones
are 1 tick too short.
--joel
> On 18/01/16 00:19, Joel Sherrill wrote:
>>
>> Hi
>>
>> With the recent clock changes, I am noticing that on some BSPs
>> ticker is reporting times 4, 9, 14, ... instead of 5, 10, 15.
>>
>> It looks like the time is 4.9999999 when it should simply be 5 so
>> ticker just reports 4.
>>
>> Given this is a visible change in behavior, I would like to know
>> what causes it and how it can be resolved?
>>
>> Thanks.
>>
>> --joel
>>
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20160119/55904044/attachment-0002.html>
More information about the devel
mailing list