{"id":298,"date":"2019-10-21T19:39:52","date_gmt":"2019-10-21T17:39:52","guid":{"rendered":"http:\/\/linuxboxen2.dk\/?p=298"},"modified":"2019-10-21T19:39:52","modified_gmt":"2019-10-21T17:39:52","slug":"clock","status":"publish","type":"post","link":"https:\/\/www.linuxboxen.dk\/?p=298","title":{"rendered":"CLOCK"},"content":{"rendered":"<p>CLOCK(3)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Linux Programmer&#8217;s Manual\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CLOCK(3)<\/p>\n<p>NAME<\/p>\n<p>clock &#8211; determine processor time<\/p>\n<p>SYNOPSIS<\/p>\n<p>#include &lt;time.h&gt;<\/p>\n<p>clock_t clock(void);<\/p>\n<p>DESCRIPTION<\/p>\n<p>The clock() function returns an approximation of processor time used<br \/>\nby the program.<\/p>\n<p>RETURN VALUE<\/p>\n<p>The value returned is the CPU time used so far as a clock_t; to get<br \/>\nthe number of seconds used, divide by CLOCKS_PER_SEC.\u00a0 If the<br \/>\nprocessor time used is not available or its value cannot be<br \/>\nrepresented, the function returns the value (clock_t) -1.<\/p>\n<p>CONFORMING TO<\/p>\n<p>C89, C99, POSIX.1-2001.\u00a0 POSIX requires that CLOCKS_PER_SEC equals<br \/>\n1000000 independent of the actual resolution.<\/p>\n<p>NOTES<\/p>\n<p>The C standard allows for arbitrary values at the start of the<br \/>\nprogram; subtract the value returned from a call to clock() at the<br \/>\nstart of the program to get maximum portability.<\/p>\n<p>Note that the time can wrap around.\u00a0 On a 32-bit system where<br \/>\nCLOCKS_PER_SEC equals 1000000 this function will return the same<br \/>\nvalue approximately every 72 minutes.<\/p>\n<p>On several other implementations, the value returned by clock() also<br \/>\nincludes the times of any children whose status has been collected<br \/>\nvia wait(2) (or another wait-type call).\u00a0 Linux does not include the<br \/>\ntimes of waited-for children in the value returned by clock().\u00a0 The<br \/>\ntimes(2) function, which explicitly returns (separate) information<br \/>\nabout the caller and its children, may be preferable.<\/p>\n<p>In glibc 2.17 and earlier, clock() was implemented on top of<br \/>\ntimes(2).\u00a0 For improved accuracy, since glibc 2.18, it is implemented<br \/>\non top of clock_gettime(2) (using the CLOCK_PROCESS_CPUTIME_ID<br \/>\nclock).<\/p>\n<p>SEE ALSO<\/p>\n<p>clock_gettime(2), getrusage(2), times(2)<\/p>\n<p>COLOPHON<\/p>\n<p>This page is part of release 3.76 of the Linux man-pages project.\u00a0 A<br \/>\ndescription of the project, information about reporting bugs, and the<br \/>\nlatest version of this page, can be found at<br \/>\nhttp:\/\/www.kernel.org\/doc\/man-pages\/.<\/p>\n<p>GNU\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 2014-09-21\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CLOCK(3)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CLOCK(3)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Linux Programmer&#8217;s Manual\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 CLOCK(3) NAME clock &#8211; determine processor time SYNOPSIS #include &lt;time.h&gt; clock_t clock(void); DESCRIPTION The clock() function returns an approximation of processor time used by the program. RETURN VALUE The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC.\u00a0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[8],"tags":[],"class_list":["post-298","post","type-post","status-publish","format-standard","hentry","category-shell"],"_links":{"self":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=298"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=\/wp\/v2\/posts\/298\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxboxen.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}