From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,3f738be55205cd6e,start X-Google-Attributes: gid111c93,public From: Alex Rhomberg Subject: gettimeofday resolution Date: 2000/03/23 Message-ID: <38DA191A.C7708BAB@ife.ee.ethz.ch>#1/1 X-Deja-AN: 601285510 Content-Transfer-Encoding: 7bit X-Trace: 23 Mar 2000 14:16:10 +0100, beethoven.ee.ethz.ch Organization: Electronics Lab, ETH Zurich, Switzerland Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: comp.os.linux.alpha I use gettimeofday for time measurement. On my PWS500a with RH 6.1, kernel 2.2.12, this works fine, giving me microsecond resolution. A test on UP2000 with SuSE 6.1 and 2.2.13 kernel returns the time with 1ms jumps The following program outputs 1 or 2 us on PWS/RH and 980 on UP2000/SuSE could somebody please test this with different configs and help me find the reason for the difference? Thanks Alex #include // for gettimeofday #include #include int main(int argc, char**argv) { struct timeval tv1, tv2; gettimeofday(&tv1, NULL); do { gettimeofday(&tv2, NULL); } while (tv1.tv_usec == tv2.tv_usec); printf("Difference: %d us\n", tv2.tv_usec - tv1.tv_usec + 1000000 * (tv2.tv_sec - tv1.tv_sec)); return 0; }