[Xenomai] userspace absolute timer value

Gilles Chanteperdrix gilles.chanteperdrix at xenomai.org
Wed Dec 23 19:43:41 CET 2015


On Wed, Dec 23, 2015 at 01:05:00PM -0500, Steven Seeger wrote:
> All,
> 
> The issue that I had with userspace absolute time to start a timer (what 
> latency test does) was due to a quirk on my board where the powerpc timebase 
> was coming up as 0xdXXXXXXXXXXXXXXX which was causing the 32-bit userland to 
> lose precision when getting the monotonic clock value. The latency test gets 
> the time, adds a millisecond, and uses this time to start the process. However 
> on my machine the time was way off due to the loss of precision. (there were 
> more than 2^32 seconds, but time_t is only 32-bit) On my board adding some 
> code to set the timebase to 0 in head_44x.S and that cleared up all the 
> issues. Everything is working for me now. This appears to be a problem with 
> how cobalt deals with 64-bit ns counters and 32-bit userspace clocks, however 
> I could be missing something.

If I understand correctly, your problem is that struct timespec
tv_sec member has 32 bits. Well, I am afraid there is not much we
can do about that (I heard mainline has a plan to switch to a new
timespec with a 64 bits tv_sec, but I do not know how much of that
plan has been implemented).

Can you not call clock_settime to set a wallclock offset which will
at least allow CLOCK_REALTIME to behave as expected ?

Regards.

-- 
					    Gilles.
https://click-hack.org



More information about the Xenomai mailing list