This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
clock subroutine in mingw returns wall clock times
- To: cygwin at cygwin dot com
- Subject: clock subroutine in mingw returns wall clock times
- From: Don Scales <scaled at gatwick dot geco-prakla dot slb dot com>
- Date: Wed, 16 May 2001 09:27:15 +0100
There seems to be a problem with the clock subroutine in the mingw
library
libcrtdll.a
This subroutine should return the number of CPU clock ticks used by the
program at the time the subroutine is called.
The clock routine in the cygwin library works ok.
The clock routine in the mingw library seems to return wall clock time.
Regards
Don
----
#include <time.h>
#include <stdio.h>
int main() {
long ca,cb,wa,wb;
float c,w;
char s[10];
ca = clock();
wa=time(0);
printf("hit enter when ready");
gets(s);
cb=clock();
wb=time(0);
c=(float) cb-ca;
w=(float)wb-wa;
c = c/(float)CLOCKS_PER_SEC;
printf("wall=%f, cpu=%f\n",w,c);
}
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple