By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,026 Members | 2,085 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,026 IT Pros & Developers. It's quick & easy.

getting current timestamp in micro secs

P: n/a
Hi,
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn't find satisfactory answer.

thanks in advance
Sep 18 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Ashit Vora <a.******@gmail.comwrote:
Hi,
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn't find satisfactory answer.

thanks in advance
There is no portable way of doing that, so you will have to use some
system-specific method to do it.
If you are using some Unix-like system, then you will probably have
gettimeofday() available. Beware though that even if it does return a value
in microseconds it will on, most systems, not be accurate to more than 10ms
or so.

If you actually need microsecond precision then whatever method you may
find, will be highly specific to your particular system and not at all
portable.


--
<Insert your favourite quote here.>
Erik Trulsson
er******@student.uu.se
Sep 18 '08 #2

P: n/a
On 18 Sep, 07:35, Ashit Vora <a.k.v...@gmail.comwrote:
I want to find the current time stamp in micro sec precision.

The requirement is,
my function is executed in an infinite loop.
I measure a value and check if the value computed is what i expected
9forget all this stuff).
I want to print the time stamp every time that event occurs.

So my requirement is printing the current timestamps.

so I can calculate the average time (in micro secs) after which such
an event occur...

I hope I made my requirement clear.

Can anybody pls help me with this problem.
I searched many discussion but couldn't find satisfactory answer.

thanks in advance
you've already been told the answer to this.
Why did you post again?

--
Nick Keighley

Sep 18 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.