Skip to contentSkip to conversation

relationship of timestamp / timer functions

Xenomai-help Axel Beierlein 2 participants 2 messages Feb 4, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

which corresponding functions do i have to use when i try to get the correct timediff between two events. Especially i get an timestamp with every CAN Message (wich is implemented with rtdm_clock_read())and on the other side i get a timestamp in my Userspace application with rt_timer_tsc(). Are they are running at the same base so that i can use the difference of both returned values of the functions?

Axel

#1 lore raw
Quoted 8 lines · Axel Beierlein

Hello,

which corresponding functions do i have to use when i try to get the correct timediff between two events. Especially i get an timestamp with every CAN Message (wich is implemented with rtdm_clock_read())and on the other side i get a timestamp in my Userspace application with rt_timer_tsc(). Are they are running at the same base so that i can use the difference of both returned values of the functions?

rt_timer_read() corresponds to rtdm_clock_read(), but rt_timer_read() returns the date as a count of clock ticks whereas rtdm_clock_read() returns the date as a count of nanoseconds. So, if you are running in periodic mode, you should compare CAN message timestamps with rt_timer_ticks2ns(rt_timer_read()), if you are running in aperiodic mode, rt_timer_ticks2ns simply returns the same value, so you can directly compare the value returned by rtdm_clock_read() and rt_timer_read().

Signature · 1 line
                                               Gilles Chanteperdrix