Skip navigation
NASA Logo, National Aeronautics and Space Administration
2253 Views 1 Reply Latest reply: Sep 28, 2007 4:32 PM by Robert Burns, III RSS
Currently Being Moderated

Sep 26, 2007 4:43 PM

High Accuracy Timers

 

Timers are available acrosss multiple platforms. ANSI C/C++ has support for timers down to the milliseconds.

 

 

Sometimes, you may need a timer with more accuracy. These high accuracy timers are platform specific (non-ANSI). For linux and it's variants (anything supporting the GNU C library), one can use the ntp_gettime function. For Windows, you can use QueryPerformanceCounter. 

 

 

 

 

 

~Shawn

 

 

  • Currently Being Moderated
    Sep 28, 2007 4:32 PM (in response to Shawn Freeman)
    Re: High Accuracy Timers

    ntp_gettime() is not currently implemented for Mac OS X.  You will need to use gettimeofday(). 

     

     

     

    The gettimeofday() function shall obtain the current time, expressed as seconds and microseconds since the Epoch, and

    store it in the timeval structure pointed to by tp. The resolution of the system clock is unspecified.

     

More Like This

  • Retrieving data ...

Bookmarked By (0)

USAGov logo NASA Logo - nasa.gov