Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>uclock</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
uclock
======

Syntax
------

     #include <time.h>
     
     uclock_t uclock(void);

Description
-----------

This function returns the number of uclock ticks since an arbitrary
time, actually, since the first call to `uclock', which itself returns
zero.  The number of tics per second is UCLOCKS_PER_SEC.

`uclock' is provided for very high-resulution timing.  It is currently
accurate to better than 1 microsecond (actually about 840 nanoseconds).
You cannot time across two midnights with this implementation, giving
a maximum useful period of 48 hours and an effective limit of 24 hours.
Casting to a 32-bit integer limits its usefulness to about an hour
before 32 bits will wrap.

Note that `printf' cannot print a value of type `uclock_t', even though
it is an integer value, because it is a 64-bit integer.

Also note that `uclock' reprograms the interval timer in your PC to act
as a rate generator rather than a square wave generator.  I've had no
problems running in this mode all the time, but if you notice strange
things happening with the clock (losing time) after using `uclock',
check to see if this is the cause of the problem.

Return Value
------------

The number of tics.

Example
-------

     printf("%d seconds have elapsed\n", (int)(uclock()/UCLOCKS_PER_SEC));


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson