nanotime()

  • Is the GNU C function
    void nanotime(struct timespec *ts);
    available in some Cocoa framework?
    It's defined in <time.h>, but the Scode (3) builder barfs when I try
    to call it:

    int main(int argc, char *argv[]) {
    struct timespec *ts;
    nanotime(&ts);
        return NSApplicationMain(argc,  (const char **) argv);
    }

    Building target “foo” of project “foo” with configuration “Release” —
    (1 error)
           cd /Users/rollos/foo
        /Developer/usr/bin/gcc-4.0 -o /Users/rollos/foo/build/foo.build/
    Release/foo.build/Objects-normal/ppc/foo -L/Users/rollos/foo/build/
    Release -F/Users/rollos/foo/build/Release -filelist /Users/rollos/foo/
    build/foo.build/Release/foo.build/Objects-normal/ppc/foo.LinkFileList -
    framework Cocoa -arch ppc -mmacosx-version-min=10.5 -isysroot /
    Developer/SDKs/MacOSX10.5.sdk
    Undefined symbols:
      "_nanotime", referenced from:
          _main in main.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
             "_nanotime", referenced from:
                 _main in main.o
      ld: symbol(s) not found
      collect2: ld returned 1 exit status
    Build failed (1 error)

    Roland Silver
    <rollos...>
  • Le 4 janv. 08 à 16:02, Roland Silver a écrit :

    > Is the GNU C function
    > void nanotime(struct timespec *ts);
    > available in some Cocoa framework?
    > It's defined in <time.h>, but the Scode (3) builder barfs when I try
    > to call it:

    I did not find any nanotime function in <time.h>

    I know only one nanotime functions on Mac OS X, the one declared in
    Kernel Headers (Kernel.framework/Headers/sys/time.h) and it can be
    call only from the kernel.

    If you need an accurate time function (in user space), have a look at
    mach_absolute_time() (http://developer.apple.com/qa/qa2004/qa1398.html).
  • perhaps what you want is nanosleep?

    filipe

    On 2008/01/04, at 15:15, Jean-Daniel Dupas wrote:

    >
    > Le 4 janv. 08 à 16:02, Roland Silver a écrit :
    >
    >> Is the GNU C function
    >> void nanotime(struct timespec *ts);
    >> available in some Cocoa framework?
    >> It's defined in <time.h>, but the Scode (3) builder barfs when I
    >> try to call it:
    >
    > I did not find any nanotime function in <time.h>
    >
    > I know only one nanotime functions on Mac OS X, the one declared in
    > Kernel Headers (Kernel.framework/Headers/sys/time.h) and it can be
    > call only from the kernel.
    >
    > If you need an accurate time function (in user space), have a look
    > at mach_absolute_time() (http://developer.apple.com/qa/qa2004/qa1398.html
    > ).
previous month january 2008 next month
MTWTFSS
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Go to today