clock function return multiples of 10000 only !!!

This is a discussion on clock function return multiples of 10000 only !!! within the C Programming forums, part of the General Programming Boards category; Hi when i use clock() function i only get multiples of 10000, is that normal? I need to find number ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    Question clock function return multiples of 10000 only !!!

    Hi

    when i use clock() function i only get multiples of 10000, is that normal? I need to find number of clocks taken by a program but i need exact number.
    I am using opensuse linux
    Any idea??

  2. #2
    qny
    qny is offline
    Registered User
    Join Date
    Sep 2012
    Posts
    355

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    per the Linux man page on clock(): C89, C99, POSIX.1-2001. POSIX requires that CLOCKS_PER_SEC equals 1000000 independent of the actual resolution.
    this vlaue it is not the CPU clock rate. it is based on the cpu clock interrupt tick rate. so if you get multiples of 10000, and CLOCKS_PER_SEC == 1000000, the resolution is 10000/1000000 = 10 milliseconds

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Clock function in c
    By newbie30 in forum C Programming
    Replies: 2
    Last Post: 08-27-2009, 02:08 PM
  2. how to use the clock() function?
    By nefsan in forum C Programming
    Replies: 2
    Last Post: 04-18-2008, 10:16 PM
  3. Digit Separation like for 10000 - 10/000
    By |HBO| in forum C Programming
    Replies: 5
    Last Post: 08-27-2007, 12:12 AM
  4. Replies: 6
    Last Post: 04-09-2006, 04:32 PM
  5. Around the Clock. Hour function ??
    By Gugge in forum C Programming
    Replies: 1
    Last Post: 08-12-2002, 04:56 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21