Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

23. Timers and Sleeping > POSIX Clocks

POSIX Clocks

POSIX clocks (originally defined in POSIX.1b) provide an API for accessing clocks that measure time with nanosecond precision. Nanosecond time values are represented using the same timespec structure as is used by nanosleep() (High-Resolution Sleeping: nanosleep() ).

On Linux, programs using this API must be compiled with the -lrt option, in order to link against the librt (realtime) library.

The main system calls in the POSIX clocks API are clock_gettime(), which retrieves the current value of a clock; clock_getres(), which returns the resolution of a clock; and clock_settime(), which updates a clock.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint