C++ Timer

This is a discussion on C++ Timer within the C++ Programming forums, part of the General Programming Boards category; Hi, I need to make a timing device in C++ which calculates the time it takes for two different inputs...I ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    6

    Question C++ Timer

    Hi, I need to make a timing device in C++ which calculates the time it takes for two different inputs...I used difftime(end, start) function to find the time diff, in seconds, but, it only gives time difference of up to 1 seconds accuracy. I need a timing device which can find time variance with more accuracy...like upto one tenth of a second..or one hundreadth of a second.

    Thanks,
    Bye MShrestha

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    use the clock() function declared in time.h it usually returns the time in milliseconds(1/1000th a second), to collect the time values then subtract them appripriatly to get the time passed.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 12:23 AM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. Need help with a count down timer
    By GUIPenguin in forum C# Programming
    Replies: 0
    Last Post: 07-07-2006, 04:18 PM
  4. Timer again.
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 05-04-2005, 10:19 PM

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