ftime() not giving miliseconds?

Pavel Machek (pavel@bug.ucw.cz)
Mon, 10 May 1999 22:11:38 +0200


Hi!

I've came accross something which looks like a bug.

#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
#include <unistd.h>

void
main( int argc, char *argv[] )
{
struct timeb tb;

ftime(&tb);
printf( "It's now %d.%d\n", tb.time, tb.millitm );
usleep(10000);
ftime(&tb);
printf( "It's now %d.%d\n", tb.time, tb.millitm );
}

Gives me:

pavel@bug:~/misc$ ./timebug
It's now 926366885.0
It's now 926366885.0
pavel@bug:~/misc$ ./timebug
It's now 926366885.0
It's now 926366885.0
pavel@bug:~/misc$ ./timebug
It's now 926366886.0
It's now 926366886.0

...which is bug in my eyes. Kernel 2.2.7, libc-2.0.7.so from debian
system. I'm not sure if it is kernel or libc...

Pavel

PS: Yes, I've rdtsc working.

>Release: libc-2.0.7
>Environment:
<machine, os, target, libraries (multiple lines)>
Host type: i386-pc-linux-gnu
System: Linux bug 2.2.7 #261 Mon May 10 21:52:24 CEST 1999 i586
unknown
Architecture: i586

Addons: crypt linuxthreads localedata
Build CFLAGS: -O2
Build CC: gcc -B$(common-objpfx)
Build shared: yes
Build profile: yes
Build omitfp: no
Stdio: libio

-- 
I'm really pavel@ucw.cz. Look at http://195.113.31.123/~pavel.          Pavel
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/