123456 microseconds equals how many milliseconds?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
It gives you the time in seconds and you need to know how many milliseconds? Well a millisecond is a thousandth of a second ... one thousand milliseconds in a second. Did I misunderstand your question??
cscgal
The Queen of DaniWeb
19,422 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
I maybe wrong, but I remember reading in a Visual Studio 6.0 book that the best resolution possible in it is 1 millisecond. So if that is the case you wont be able to measure 0.00045 seconds. It will come as 0.
PS.
Isn't the greeting "Respected Sir/madam" a bit out of date? It drives me nuts.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
The functions in time.h are only accurate to 1 second -- so no matter how you divide it you still have only 1 second accuracy. You need to use other functions, such as clock(), or win32 api function GetTickCount(), or GetSystemTime() that provide more accuracy.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
The functions in time.h are only accurate to 1 second -- so no matter how you divide it you still have only 1 second accuracy. You need to use other functions, such as clock(), or win32 api function GetTickCount(), or GetSystemTime() that provide more accuracy.
Do you know the resolution of those functions. As I said earlier I remember that Clock() had only a resolution of 1ms.
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
I need to find out the execution time of a fragment of code.
You don't need finer resolution timing. If you want to measure the thickness of a piece of paper, would you buy an expensive microscope, or would you measure a stack of 200 pieces of paper and then divide by 200?
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
The most precise unit is as precise as you can get, so Rashakil's analogy does not make sense to me. You can get less precise, but not more precise.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
You don't need finer resolution timing. If you want to measure the thickness of a piece of paper, would you buy an expensive microscope, or would you measure a stack of 200 pieces of paper and then divide by 200?
In other words, run it a whole bunch of times until it runs to 10 seconds, then divide 10 by the number of times it ran. Now, of course, all that counting and looping will throw off your results -- after all, that code and all the calls to time() also take time. So you'll be off only by 5-15%.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
i don't think you can use the concept of 200 pages to measure time accurately.
but you can wait 3 1/2 years to respond to a thread and divide that time by the number of total posts, for a rough estimate of the number of thread-posts per year.
amirite?
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
uRrite. Just another case of some turkey not caring that 100 pages in on a forum might be moot thread. Nothing better to do, obviously.
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944