This is the mail archive of the
mailing list for the Cygwin project.
gettimeofday() does not returns usec resolution
- From: "Ralf Habacker" <Ralf dot Habacker at freenet dot de>
- To: "Cygwin" <cygwin at sources dot redhat dot com>
- Date: Wed, 23 Jan 2002 08:20:48 +0100
- Subject: gettimeofday() does not returns usec resolution
for kde2 we are building a profiler lib for profiling complex c++ applications (currently found in the cvs areas of
using the high resolution timer of native windows (about usec resolution).
This lib could be use for easy profiling of any c++ application and libs like cygwin.dll and so on.
While adding unix support (and cygwin) for this lib, I noticed, that the gettimeofday() function returns only a
resolution of 10ms (the time slice resolution) but mostly other unix os returns a resolution in the usec region. I
have appended a testcase for this.
Has anyone address this problem already. I have looked int the cygwin and list and found the only topic
In http://www-106.ibm.com/developerworks/library/l-rt1/ there is a detailed instruction how to use the hugh
resolution counter. .
$ cat timeofday.c
struct timeval tp;
a = ((unsigned)tp.tv_sec)*1000000+((unsigned)tp.tv_usec);
printf("timestamp (us): %d\n",a);
b = ((unsigned)tp.tv_sec)*1000000+((unsigned)tp.tv_usec);
printf("timestamp (us): %d (diff) %d\n",b,b-a);
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html