By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,144 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,144 IT Pros & Developers. It's quick & easy.

what do the values of "clocks ticks" and "CLOCK_PER_SEC" represent?

P: n/a
what do the values of "clocks_ticks = sysconf(_SC_CLK_TCK);" and
"CLOCK_PER_SEC" represent?

Jan 30 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
chandanlinster <ch************@gmail.comwrote:
what do the values of "clocks_ticks = sysconf(_SC_CLK_TCK);" and
"CLOCK_PER_SEC" represent?
"CLOCKS_PER_SEC" (I guess you meant that) is the time the value
returned by the function clock() must be divided by to give a
time in seconds. What the non-standard-C (but POSIX) function
sysconf() returns for "_SC_CLK_TCK" (also not a standard-C but
POSIX defined value) is the time resolution the values returned
by the times() function are in (you may already have guessed
that this is also not a standard-C but POSIX function;-).They
typicaly are the not the same. And neither of them is meant to
be confused with the clock rate of the processor(s).

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Jan 30 '07 #2

P: n/a
Jens Thoms Toerring wrote:
chandanlinster <ch************@gmail.comwrote:
>what do the values of "clocks_ticks = sysconf(_SC_CLK_TCK);" and
"CLOCK_PER_SEC" represent?

"CLOCKS_PER_SEC" (I guess you meant that) is the time the value
returned by the function clock() must be divided by to give a
time in seconds. What the non-standard-C (but POSIX) function
sysconf() returns for "_SC_CLK_TCK" (also not a standard-C but
POSIX defined value) is the time resolution the values returned
by the times() function are in (you may already have guessed
that this is also not a standard-C but POSIX function;-).They
typicaly are the not the same. And neither of them is meant to
be confused with the clock rate of the processor(s).
I'm grateful for this explanation. In addition, it's often said that
POSIX dictates a fixed value of 1000000 for CLOCKS_PER_SEC, which seems
to me to be at odds with satisfactory C usage. This leads to what I
would call wasting 10000 increments in the typical case where clock()
has a physical resolution of 0.010 second. You find this out, for
example, by evaluating clock() in a loop and finding that it increments
by 10000 whenever it changes.
This unfortunate situation increases the incentive to use alternatives
to standard C clock().
Jan 30 '07 #3

P: n/a
Thanks a lot for the explaination!!!

Feb 1 '07 #4

P: n/a
chandanlinster wrote:
Thanks a lot for the explaination!!!
What explanation? You really need to include context when you post. My
news server has expired the original article to which you are replying.

Does anyone still have the original article along with the reply and if
so could you post it please?
Feb 13 '07 #5

P: n/a
Op Tue, 13 Feb 2007 07:29:18 -0600 schreef Joe Estock:
chandanlinster wrote:
>Thanks a lot for the explaination!!!
What explanation? You really need to include context when you post. My
news server has expired the original article to which you are replying.

Does anyone still have the original article along with the reply and if
so could you post it please?
I agree fully, but why wait more than twelve days to reach to this
conclusion ? ;-)
--
Coos
Feb 13 '07 #6

P: n/a
Coos Haak wrote:
Op Tue, 13 Feb 2007 07:29:18 -0600 schreef Joe Estock:
>chandanlinster wrote:
>>Thanks a lot for the explaination!!!
What explanation? You really need to include context when you post. My
news server has expired the original article to which you are replying.

Does anyone still have the original article along with the reply and if
so could you post it please?

I agree fully, but why wait more than twelve days to reach to this
conclusion ? ;-)
It's not intentional; I seem to have less and less of this "free time" I
hear so many people talking about these days and it takes me a while to
catch up. It was by chance I even saw this article in the first place.
Apr 25 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.