How can I get microseconds in windows=?big5?Q?=3F=3F=3F?=

´

´_¬¡¤F

I can include time.h and use time() to get UTC seconds,but

how can I get microseconds ??

My OS is windows.
 
V

Victor Bazarov

´_¬¡¤F said:
I can include time.h and use time() to get UTC seconds,but

how can I get microseconds ??

My OS is windows.

Then ask in comp.os.ms-windows.programmer. C++ language doesn't have
any microsecond-resolution functions.
 
J

Jeff Garland

I can include time.h and use time() to get UTC seconds,but

how can I get microseconds ??

My OS is windows.

The CVS version of boost date_time has a class called microsec_clock
that allows you to write this:

using namespace boost::posix_time;
ptime t = microsec_clock::local_time();
...

On windows this uses the ftime API which will be millisecond
resolution for sure and some hardware might be micro-second. You'll
have to try it to be sure. On Unix this clock uses the GetTimeOfDay
interface which seems to reliably produce microsecond level samples.

If you want this in a released version of Boost you'll probably need
to wait a few weeks until 1.32 is released.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top