Connecting Tech Pros Worldwide Forums | Help | Site Map

getting current timestamp in micro secs

Ashit Vora
Guest
 
Posts: n/a
#1: Sep 18 '08
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

Erik Trulsson
Guest
 
Posts: n/a
#2: Sep 18 '08

re: getting current timestamp in micro secs


Ashit Vora <a.k.vora@gmail.comwrote:
Quote:
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
ertr1013@student.uu.se
Nick Keighley
Guest
 
Posts: n/a
#3: Sep 18 '08

re: getting current timestamp in micro secs


On 18 Sep, 07:35, Ashit Vora <a.k.v...@gmail.comwrote:
Quote:
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

Closed Thread


Similar C / C++ bytes