cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
clock with 4 decimal accuracy?
clock with 4 decimal accuracy?
Dec 27, 2011 at 3:33pm UTC
liquidmonkey
(19)
i'm using CLOCK_PER_SEC to time how long a function takes and am wondering if its possible to get the timing to 4 decimal places?
at the moment i can get 2 decimal places?
code i use
------------------------------
clock_t st = clock();
** calculations **
clock_t fin = clock();
float diff = float (fin - st) / CLOCKS_PER_SEC;
------------------------------
Dec 28, 2011 at 12:08pm UTC
coder777
(8444)
use double for a better accuracy
Dec 28, 2011 at 2:54pm UTC
liquidmonkey
(19)
thanks but even when using double i still only get a 0.01 or 0.1 value on output.
anyway to get a 0.004 value from the output?
both double and float go down to at least 10 decimals but yet i only get a 2 decimal output. what am i missing :(
Topic archived. No new replies allowed.