Thanks, I wasn't too familiar with that stuff, guess I should have been more suspicious of the (9) in the man page entry. although not likely, the code may cross a day threshold, and gettimeofday could be problematic. What is the simplest way to get a time interval on something that may cross a day threshold (in ms or preferrably ns?). I know clock() can get me ticks, but it'll take work to conver that to second (any simple way to do that)? I understand clock is for the given thread, and not absolute time, but both may be relevant at some point. Thank you, -Jim Stapleton On 8/31/07, Brian Dessent <brian@xxxxxxxxxxx> wrote: > Jim Stapleton wrote: > > > FreeBSD > > ======================================== > > [sjss@elrond ~/dev/numbench]$ gcc numbench.c > > /var/tmp//ccnZ4l7C.o(.text+0x155c): In function `loop_calibrate': > > : undefined reference to `nanotime' > > /var/tmp//ccnZ4l7C.o(.text+0x15b6): In function `loop_calibrate': > > : undefined reference to `nanotime' > > /var/tmp//ccnZ4l7C.o(.text+0x15ec): In function `iterbenchI': > > : undefined reference to `nanotime' > > /var/tmp//ccnZ4l7C.o(.text+0x165d): In function `iterbenchI': > > : undefined reference to `nanotime' > > /var/tmp//ccnZ4l7C.o(.text+0x1694): In function `iterbenchF': > > : undefined reference to `nanotime' > > /var/tmp//ccnZ4l7C.o(.text+0x1705): more undefined references to > > `nanotime' follow > > ======================================== > > On FreeBSD this is a kernel mode interface, not available to userspace. > That is why the manpage is in section 9. So you can't call this > function from a normal program. > > > Cygwin: > > ======================================== > > $ gcc numbench.c -lc -lm > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x2b4): > > undefined reference to `_srandomdev' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x13ef): > > undefined reference to `_nanotime' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1445): > > undefined reference to `_nanotime' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1478): > > undefined reference to `_nanotime' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x14e5): > > undefined reference to `_nanotime' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1518): > > undefined reference to `_nanotime' > > /cygdrive/c/DOCUME~1/STAPLE~1/LOCALS~1/Temp/ccSqoE54.o:numbench.c:(.text+0x1585): > > more undefined references to `_nanotime' follow > > collect2: ld returned 1 exit status > > ======================================== > > Cygwin does not provide the nanotime function. > > > I tried adding a few libraries that might be useful: -lc -lm -lmd > > -lpthread, but with no luck. I figured I'd try to find what library it > > is in, but couldn't (strings /lib/* | grep nano; string /usr/lib/* | > > grep nano). I could only find nanosleep, and a few other non-nanotime > > references. > > The problem is that you're expecting to be able to use a nonstandard > function where it does not exist. I think you need to switch APIs if > you want to build your code on these platforms. gettimeofday(2) should > give you microsecond resolution and is POSIX standard. > > Brian >