Q: Timer with <sec resolution

J

Jo. Schmitt

Hi all!

Each time an event happens I want to print a timestamp.
Using 'time_t' etc. works fine but it only has attributes for
an 'one second resolution'.

I tried to examine the code of Tcp-/Windump because
they have a 0.000000 second resolution. Unfortunatly I
dont really understand the code there. Could only
figure out that a 'timeval' struct from the BSD/time.h
file has been used. (which I do not have an could not download
from the www (maybe its not free anyway)

How are you programming timers with an sec.000 resolution??
A ms resulution would be fine for me :)

THX
 
J

Jeff Schwab

Jo. Schmitt said:
Hi all!

Each time an event happens I want to print a timestamp.
Using 'time_t' etc. works fine but it only has attributes for
an 'one second resolution'.

I tried to examine the code of Tcp-/Windump because
they have a 0.000000 second resolution.

Shouldn't there be something other than 0 in there?
Unfortunatly I
dont really understand the code there. Could only
figure out that a 'timeval' struct from the BSD/time.h
file has been used. (which I do not have an could not download
from the www (maybe its not free anyway)

How are you programming timers with an sec.000 resolution??
A ms resulution would be fine for me :)

THX

I don't believe there is a standard, portable way of doing this. Try a
platform-specific newsgroup. It looks like you might be using FreeBSD,
so help shouldn't be hard to find.

Good luck,
Jeff
 
M

Mike Smith

Jo. Schmitt said:
Hi all!

Each time an event happens I want to print a timestamp.
Using 'time_t' etc. works fine but it only has attributes for
an 'one second resolution'.

I tried to examine the code of Tcp-/Windump because
they have a 0.000000 second resolution. Unfortunatly I
dont really understand the code there. Could only
figure out that a 'timeval' struct from the BSD/time.h
file has been used. (which I do not have an could not download
from the www (maybe its not free anyway)

How are you programming timers with an sec.000 resolution??
A ms resulution would be fine for me :)

Well, I use QueryPerformanceCounter(), but that only works in Win32.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top