473,507 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I get microseconds in windows???


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

how can I get microseconds ??

My OS is windows.

--
>> ¥xÆW¬ì¤j¸ê¤u¨t ²M¬y¯¸ # ntust.org #
>> Author from: 218-35-21-103.cm.dynamic.apol.com.tw 
Jul 22 '05 #1
3 5036
"´_¬¡¤F" <as*******@ntust.org> wrote...

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.
Jul 22 '05 #2
> I can include time.h and use time() to get UTC seconds,but
how can I get microseconds ??
My OS is windows.


Your question is offtopic here, please read the FAQ at
http://www.parashift.com/c++-faq-lite before posting.

<OT>
Check out QueryPerformanceCounter() function from Windows API
</OT>

Cheers,
Marcin
Jul 22 '05 #3
as*******@ntust.org (?_???F) wrote in message news:<4D********@ntust.org>...
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
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
15206
by: Ken Lindner | last post by:
I have a need to become familiar with SQL Server 2000 for work. Needless to say I am new to SQL Server any version, but not IT in general. My employer has provided me with the SQL Server 2000...
2
733
by: Michael Evans | last post by:
First, we rely on a stable update rate so that our physics and dynamics calculations and integrations are based on a known interval and therefore are true-to-life. Second, the graphics positions...
1
3435
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
3905
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
2
6897
by: In. Martin Prá¹ek | last post by:
I I read the documentation well (PG 7.3.3 ) , i see that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressed as microseconds" ie there it is impossible...
0
1576
by: NTPT | last post by:
I read the documentation well (PG 7.3.3 ) , it seems that there is not a native support for data type UNIX TIMESTAMP and "unix timestamp expressedas microseconds" ie there it is impossible...
5
5440
by: mroeloffs | last post by:
Hi I have a time in microseconds, for example 0x8C905CBA7F84AF4. I want this to a normal view in hh:mm:ss DD:MM:YYYY. I tried with datetime, but it only takes a max of 1000000 microseconds is there...
3
8900
by: Francesco | last post by:
I search a function to calculate microseconds in a time istant
7
18280
by: i12know | last post by:
Hi guys, I have tried a lot of code and read forums discussing about C or C++ functions that measures time in microsecond, but there still seems to be confusions about that. Can anyone tell me...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.