counting milliseconds in C or C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nightrider2007
    New Member
    • Aug 2011
    • 2

    counting milliseconds in C or C++

    Hi all

    I want to count milliseconds in c or C++.
    I know that its possible to count second. In some places I found that people divide second by 1000. But i think that is not the exact solution.

    please me.
  • mac11
    Contributor
    • Apr 2007
    • 256

    #2
    Yes, it's not really millisecond resolution to divide by 1000.

    Your operating system usually provides some timer library support. For instance, if you're working on linux you can use clock_gettime() and related functions to get better resolution timing (see 'man clock_gettime') .

    Comment

    • nightrider2007
      New Member
      • Aug 2011
      • 2

      #3
      Originally posted by mac11
      Yes, it's not really millisecond resolution to divide by 1000.

      Your operating system usually provides some timer library support. For instance, if you're working on linux you can use clock_gettime() and related functions to get better resolution timing (see 'man clock_gettime') .
      Hi thanks a lot for your reply.

      Actually, my platform is windows XP. Do you have any suggestion for it?

      regards
      Nightrider

      Comment

      Working...