Saurabh wrote:
Hi ,
i am working with g++ on Linux.is there a way in C++ to get current
time in milliseconds.( <ctime> provides accuracy upto seconds).
I googled for it,searched the newsgroup but couldnt find anything.
You did? Searching for "time millisecond" in comp.lang.c++ gives some
pretty good results.
Time and date features are found in <ctime>. However, what the accuracy
of time() is implementation defined. Implementations are not even
required to provide a working time() function.
That <ctime> "provides accuracy up to seconds" is wrong, I think. POSIX
requires CLOCKS_PER_SEC to be 1,000,000 (microseconds) and Windows has
1000 (millisecond, on Visual C++ 2005).
You may be better served by platform specific features if you require
more precise timing. See
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9 for
newsgroup suggestions.
Jonathan