Jan Birke wrote:
> Am 04.12.2007 um 00:10 schrieb Jan Kiszka:
>
>> Jan Birke wrote:
>>>
>>> Currently I read my clock with clock_gettime(CLOCK_REALTIME, &clocktime)
>>
>> Provided by Xenomai's POSIX skin or by normal Linux?
>
> Ok, my time was provided by normal Linux, I included <time.h> and linked
> with -lrt
>
>> Use the real-time extension to get this time, check its documentation
>> for the appropriate function.
>
> Now I included <posix/time.h> and removed -lrt. But the linker tells me:
> undefined reference to `clock_gettime'
>
>> This might be a bit too general. Posting your code (relevant parts) and
>> describing your setup in more details may help to become more concrete.
>
> The Makefile tries to compile with these arguments:
> gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT
> -I/usr/local/rtnet/include -L/usr/xenomai/lib -lpthread -lnative
> -lrtdm -lexpat -Xlinker -rpath -Xlinker /usr/xenomai/lib
> globaltime_example.c -o globaltime_example
>
> some relevant code parts:
> int mw_global_time(struct mw_time *time)
> {
> int64_t timeoffset;
> struct timespec clocktime;
> ...
> rt_dev_ioctl(tdma_dev, RTMAC_RTIOC_TIMEOFFSET, &timeoffset);
> clock_gettime(CLOCK_REALTIME, &clocktime);If you are using the native skin, try rt_timer_read() here. Then add the offset to that time and you'll have the global time. > ... > //calculate whole seconds in offset and add to clocktime, add the > remaining nanoseconds > } > > I think if I could get the clock_gettime work with the realtime > extension, this might solve the discrepancy. clock_gettime is overloaded by the posix skin if you link your application appropriately. Then it returns the Xenomai time as well. > >>> I also played around with manipulating the system time, but the >>> offset displayed in tdma-api.c example did not change, it was always >>> around 130 seconds. > > Nevertheless I'd like to understand how Xenomai meassures time, since > setting system time to another value is not affecting the offset. Would Xenomai has its own time base which is not affected by changing the time-of-day under Linux (at least not yet). > using CLOCK_MONOTONIC achieve that behaviour? CLOCK_MONOTONIC is also under Linux an untunable time base, that's why it is monotonic. Jan
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________ RTnet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rtnet-users

