943,540 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 2767
  • C++ RSS
Nov 9th, 2008
0

Clock tick

Expand Post »
What is a clock tick equal to in ctime??
Similar Threads
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
volscolts16 is offline Offline
50 posts
since Feb 2007
Nov 9th, 2008
0

Re: Clock tick

Im guessing you mean in relation to realy time, you may want to use CLOCKS_PER_SEC to get things in terms of time and in terms of time to clocks for example divide clock()/CLOCKS_PER_SEC withh give you how many seconds, etc and if you want to wait for x seconds do seconds*CLOCKS_PER_SEC

Chris
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008
Nov 9th, 2008
0

Re: Clock tick

What is a clock tick equal to in ctime??
The time_t type is an implementation-defined arithmetic type capable of representing times. Use difftime function to get the difference between two times of type time_t in seconds as a double value:
  1. #include <time.h>
  2. ...
  3. time_t t;
  4. time(&t);
  5. printf("time_t step %f sec\n",difftime(t+1,t)); // time_t precision
As usually, it's equal to 1 sec (but it's not the language standard requirement).
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Where does Modulus fit in with PEMDAS?
Next Thread in C++ Forum Timeline: double data type





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC