Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <5F4D0B436B7FD311B00C0008C724ADA6018C0A2C@ntmsg0009.corpmail.telstra.com.au> From: "Wong, Homer" To: cygwin AT sourceware DOT cygnus DOT com Cc: "Wong, Homer" Subject: Can Cygwin's gettimeofday() count to 30us resolution instead of 1 0ms? Date: Wed, 22 Mar 2000 16:57:43 +1100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain Hi Can Cygwin's gettimeofday() measure down to Linux's 30us (microsecond) timer resolution instead of Windows' 10 ms (millisecond) timer resolution? I used the following program to test gettimeofday(): #include #include #include int main() { struct timeval tv; int i; for (i=0; i<1000;i++) { gettimeofday(&tv, (struct timezone *) 0); printf("%lf \n", tv.tv_sec * 1000000.0 + tv.tv_usec ); } } When I compiled it using Cygwin B20.1 on a Pentium II ??? Windows NT box, the (annotated) output was: 217722273000.000000 (repeated ??? times) 217722283000.000000 (repeated 287 times) 217722293000.000000 (repeated 287 times) 217722303000.000000 (repeated 287 times) 217722313000.000000 (repeated ??? times) Basically, it was only measuring at 273ms, 283ms, 293ms i.e. about every 10ms. When I compiled it using gcc-2.7.2.1-2 on a Pentium II ??? Red Hat Linux 4.2 box, I got 1000 uniq time values e.g.: 953703420374555.000000 953703420374954.000000 953703420374986.000000 953703420375010.000000 953703420375032.000000 953703420375055.000000 This was much better, measuring at 374.555ms, 374.954ms, 374.986ms, 375.010ms i.e. about every 30us. The Linux code for gettimeofday() is in /usr/src/linux/arch/i386/kernel/time.c or http://src.openresources.com/linux-2.2.1/S/arch%20i386%20kernel%20time.c.htm l#250 or http://src.openresources.com/linux-2.2.1/D/do_gettimeofday.html. Homer Wong, Telstra, Australia hwong AT telstra DOT com DOT au -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com