From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,4b037264b49124bb,start X-Google-Attributes: gid111c93,public From: Michael Baloh Subject: gettimeofday problems Date: 1998/06/12 Message-ID: <35817BB3.6E47EA3D@virginia.edu>#1/1 X-Deja-AN: 362103649 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: University of Virginia Newsgroups: comp.os.linux.alpha hello, i am trying to access the clock time via 'gettimeofday' for a real time application. this application works correctly for i386 machines, but performs poorly for Linux version 2.0.32 alpha w/ gcc version 2.7.2.3. the problem manifests itself in this way. i use 'gettimeofday' to acces the system clock. however, the state of the clock does not change every micro second but abaout every 980usec.! i have included the essential piece of code below that i using to perform this test unsigned long sampleclock(void); #include #include #include /* for sleep and usleep */ #include /* for pow() */ /* now include some special headers */ #include /* for inw, inb, outw, outb, ioperm */ #include #include #define maximum_sample_number 2000 unsigned long t1,t2,temp[maximum_sample_number]; main() { t1=sampleclock(); while(sample_number<1000) { t2=sampleclock(); if(t2!=t1) { temp[sample_number]=t2; t1=t2; sample_number++; } } for(sample_number=0;sample_number<1000;sample_number++) printf("\n%d %lu",sample_number,temp[sample_number]); } unsigned long sampleclock(void) { struct timeval ttt, (*t)=(&ttt); struct timezone zzz, (*z)=(&zzz); /* sample the clock */ gettimeofday(t,z); /* Convert everything to microseconds */ return 1000000 * t->tv_sec + t->tv_usec; } basically, are there any particular details involves in hardare manegment that i am unaware of? any advice would be appreciated naihong wei nw4n@virginia.edu