Ce ciudat :)
Din graba am inclus si <time.h> si sa vezi ca face cum zic eu. Daca scot
time.h si las doar sys/time.h atunci merge klumea. De ce?
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
int main(void)
{
struct timeval now;
for(;;) {
gettimeofday(&now, NULL);
printf("timpul: %ld, %ld\n",now.tv_sec, now.tv_usec);
}
return 0;
}
On Thu, 30 May 2002, Radu Greab wrote:
> On Thu, 30 May 2002, Mihai RUSU wrote:
> > Aha, ciudat la mine nu face asa, in exemplul tau e clar dar la mine scad
> > usec-urile cam cu 10000 , tare ciudat. Tu ce format folosesti pentru
> > afisare (printf) ? %ld ?
>
> #include <stdio.h>
> #include <sys/time.h>
>
> int main() {
> struct timeval t;
> while (1) {
> gettimeofday(&t, NULL);
> printf("%ld.%ld\n", t.tv_sec, t.tv_usec);
> }
> }
>
> Compilat cu gcc -O2, rulat pe un SMP cu PIII la 750 MHz. Daca il rulez in
> terminalul kde sare mai mult, rulat cu outputul redirectat intr-un fisier
> face ce ai vazut.
>
>
> --
> Radu Greab
>
> ---
> Pentru dezabonare, trimiteti mail la
> [EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'.
> REGULI, arhive si alte informatii: http://www.lug.ro/mlist/
>
>
>
----------------------------
Mihai RUSU
Disclaimer: Any views or opinions presented within this e-mail are solely
those of the author and do not necessarily represent those of any company,
unless otherwise specifically stated.
---
Pentru dezabonare, trimiteti mail la
[EMAIL PROTECTED] cu subiectul 'unsubscribe rlug'.
REGULI, arhive si alte informatii: http://www.lug.ro/mlist/