This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

clock subroutine in mingw returns wall clock times


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]