| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Jo. Schmitt" |
| Date: |
23 Dec 2003 10:12:27 AM |
| Object: |
Q: Timer with |
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
.
|
|
| User: "Jeff Schwab" |
|
| Title: Re: Q: Timer with |
23 Dec 2003 11:13:12 AM |
|
|
Jo. Schmitt wrote:
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
.
|
|
|
|
| User: "Mike Smith" |
|
| Title: Re: Q: Timer with |
23 Dec 2003 02:53:17 PM |
|
|
Jo. Schmitt wrote:
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.
--
Mike Smith
.
|
|
|
| User: "Eric Nicolas" |
|
| Title: Re: Q: Timer with |
24 Dec 2003 09:26:50 AM |
|
|
Jo. Schmitt wrote:
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'.
You can try to use Sword C++ Library.
Its "sword::Time" class has a millisecond resolution.
And it should be portable to Window and Linux (at least).
http://www.erik-n.net/sword/
Eric.
.
|
|
|
|
|

|
Related Articles |
|
|