468,234 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,234 developers. It's quick & easy.

getting current timestamp in micro secs

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
2 4516
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
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.

Similar topics

1 post views Thread by Bob | last post: by
1 post views Thread by George Develekos | last post: by
8 posts views Thread by Chris | last post: by
3 posts views Thread by Zhaohui | last post: by
11 posts views Thread by singlal | last post: by
30 posts views Thread by Ashit Vora | last post: by
1 post views Thread by Neel | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.