Herzlich Willkommen, lieber Gast!
  Sie befinden sich hier:

  Forum » C / C++ (ANSI-Standard) » timer in milliseconds

Forum | Hilfe | Team | Links | Impressum | > Suche < | Mitglieder | Registrieren | Einloggen
  Quicklinks: MSDN-Online || STL || clib Reference Grundlagen || Literatur || E-Books || Zubehör || > F.A.Q. < || Downloads   

Autor Thread - Seiten: > 1 <
000
27.10.2003, 16:23 Uhr
~mart
Gast


hello,

can anybody give me a piece of code , or a hint , how i can recieve the time i need for connect() to another host in milliseconds.

My problem is i want test the performance of ipsec, so i need the time in milliseconds, how long it takes to connect to another host over ipsec.

1) i tried clock() but clock() don't work, because connect() don't use cpu time like sleep(), so i always get 0 milliseconds, but the connect takes about 2 seconds (i test this with a sniffer) .

is the any way to get the time in milliseconds ????

thanks a lot and best regards, stefan
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
001
27.10.2003, 16:38 Uhr
Windalf
Der wo fast so viele Posts wie FloSoft...
(Operator)


if you are using windows this will be a good time approximation


C++:
LONGLONG Frequency, CurrentTime, LastTime;
double TimeElapsed, TimeScale;
QueryPerformanceFrequency( (LARGE_INTEGER*) &Frequency);
TimeScale = 1.0/Frequency;
QueryPerformanceCounter( (LARGE_INTEGER*) &LastTime);
for(int i=0;i<100000;++i);  //do something
QueryPerformanceCounter( (LARGE_INTEGER*) &CurrentTime);
TimeElapsed = (CurrentTime - LastTime) * TimeScale;
printf("\nTime elapsedt%f\n",TimeElapsed);


--
...fleißig wie zwei Weißbrote
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
002
27.10.2003, 16:51 Uhr
virtual
Sexiest Bit alive
(Operator)


Try gettimeofday (Unix) or ftime(Unix) or _ftime(Windows)
--
Gruß, virtual
Quote of the Month
Ich eß' nur was ein Gesicht hat (Creme 21)
 
Profil || Private Message || Suche Download || Zitatantwort || Editieren || Löschen || IP
Seiten: > 1 <     [ C / C++ (ANSI-Standard) ]  


ThWBoard 2.73 FloSoft-Edition
© by Paul Baecher & Felix Gonschorek (www.thwboard.de)

Anpassungen des Forums
© by Flo-Soft (www.flo-soft.de)

Sie sind Besucher: