Delivered-To: listarch-cygwin AT sourceware DOT cygnus DOT com Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <36B9C2ED.CCB0F024@ix.netcom.com> Date: Thu, 04 Feb 1999 10:55:25 -0500 From: "Bradley A. Town" X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: gnu-win32 AT cygnus DOT com Subject: [B20.1] stdio and timing issues Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am having some trouble with stdin and timing. 1) It sometimes misses printing a line. 2) Whatever clock() uses for timing appears to not count the time it waits for user input with, for example, getc. 3) Pressing Ctrl+Z for the input seems to kill stdin routines. Ctrl+C doesn't even kill it then. I have B20.1 running under WinNT 4.0 SP4 with CYGWIN set to `tty' and TERM set to `pcansi'. I've tried the latest coolview and different TERM settings, to no avail. I'm including an example program below. It does what I'd expect under Mingw32 and DJGPP, but it has the aforementioned issues under Cygwin. I would appreciate any help on this. Thanks! Brad --- cut here --- #include #include #define TWOLINES #define EMPTYLOOP 0xFFFFFF /* Input ----- Expects the user to press Enter. Output ------ Prints the start clock(), the end clock(), and the difference in seconds. Cygwin issues ------------- It sometimes misses printing the second line. When TWOLINES is defined, it usually prints both, but not always. When it isn't defined, it usually doesn't print a line. (Strange problem with stdout?) The end clock() printed is always nearly the same. Defining EMPTYLOOP shows that it does pause after receiving an Enter; however, it doesn't appear to count the time waiting for user input. (Different behavior than djgpp and mingw32.) Pressing Ctrl+Z for the input seems to kill the stdin routine. Ctrl+C doesn't even kill it then; I have to use Task Manager. */ int main() { clock_t clkStart = clock(); clock_t clkEnd; int i; i = getc(stdin); #ifdef EMPTYLOOP for (i = 0; i < EMPTYLOOP; i++) ; #endif clkEnd = clock(); printf("%d -> %d: " #ifdef TWOLINES "\n" #endif "%f seconds.\n", clkStart, clkEnd, (float)(clkEnd - clkStart) / CLOCKS_PER_SEC); return 0; } --- cut here ---