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); ...//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.
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 using CLOCK_MONOTONIC achieve that behaviour?
Jan
PGP.sig
Description: This is a digitally signed message part
------------------------------------------------------------------------- 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 RTnet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rtnet-users