This is the mail archive of the cygwin 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]
Other format: [Raw text]

does usleep() sleep more than it's supposed to?


Good Day,

I'm writing an application that requires time precisions up to the
microsecond level.  However, I put a hard-coded adjustment of
9000 microseconds since usleep() seems to sleep on the average of
9000 microseconds more than it's supposed to, at least on my
system.  I could work with up to 2000 microseconds for
function overhead but 9000 microseconds seems to be too long.

I've attached a simple test case that let's usleep() sleep at
100000 microseconds at each call.

I've also included the output of cygcheck -svr.

The output of the attached code on my system is the following:

admin@host144 /cygdrive/e/midi
$ gcc time2.c

admin@host144 /cygdrive/e/midi
$ ./a.exe
Print elapsed time at every call to usleep()
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:110000
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:110000
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:110000
Elapsed time (sec:microsec) 0:109000
Elapsed time (sec:microsec) 0:109000

Print elapsed after the loop()
Elapsed time (sec:microsec) 1:94000
                            ^^^^^^^
                         calling usleep() 10 times
                         made it sleep an additional
                         94000 microseconds.



Please note that I am aware of GetSystemTimeAdjustment()
and it seems not to have an effect on my observations.

Is the above the expected usleep() behaviour? If not, how do we let usleep() sleep properly?


Thank you very much!


Best Regards,

Carlo



--
Carlo Florendo
Softare Engineer/Network Co-Administrator
Astra Philippines Inc.
UP-Ayala Technopark, Diliman 1101, Quezon City
Philippines
http://www.astra.ph

Member of the Astra Group of Companies
5-3-11 Sekido, Tama City
Tokyo 206-0011, Japan
http://www.astra.co.jp
Cygwin Configuration Diagnostics
Current System Time: Mon Feb 26 15:50:36 2007

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 4

Path:	e:\cygwin\usr\local\bin
	e:\cygwin\bin
	e:\cygwin\bin
	e:\cygwin\usr\X11R6\bin
	c:\WINNT\system32
	c:\WINNT
	c:\WINNT\System32\Wbem
	f:\cygwin\bin
	d:\MySQL\MySQL Server 4.1\bin
	d:\Common Files\GTK\2.0\bin
	d:\Microsoft Visual Studio\Common\Tools\WinNT
	d:\Microsoft Visual Studio\Common\MSDev98\Bin
	d:\Microsoft Visual Studio\Common\Tools
	d:\Microsoft Visual Studio\VC98\bin
	e:\cygwin\usr\local\bin
	e:\cygwin\usr\local\sbin

Output from e:\cygwin\bin\id.exe (nontsec)
UID: 1000(admin)    GID: 513(None)
0(root)             513(None)           544(Administrators) 545(Users)

Output from e:\cygwin\bin\id.exe (ntsec)
UID: 1000(admin)    GID: 513(None)
0(root)             513(None)           544(Administrators) 545(Users)

SysDir: C:\WINNT\system32
WinDir: C:\WINNT

USER = 'admin'
PWD = '/cygdrive/e/midi'
CYGWIN = 'server'
HOME = '/home/admin'
MAKE_MODE = 'unix'

HOMEPATH = '\Documents and Settings\admin'
MANPATH = '/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man'
APPDATA = 'C:\Documents and Settings\admin\Application Data'
HOSTNAME = 'host144'
TERM = 'xterm'
PROCESSOR_IDENTIFIER = 'x86 Family 15 Model 1 Stepping 2, GenuineIntel'
WINDIR = 'C:\WINNT'
WINDOWID = '7879448'
OLDPWD = '/cygdrive/e/fd'
USERDOMAIN = 'THORIN'
OS = 'Windows_NT'
ALLUSERSPROFILE = 'C:\Documents and Settings\All Users'
OS2LIBPATH = 'C:\WINNT\system32\os2\dll;'
TEMP = '/cygdrive/c/DOCUME~1/admin/LOCALS~1/Temp'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
LIB = 'D:\Microsoft Visual Studio\VC98\mfc\lib;D:\Microsoft Visual Studio\VC98\lib'
USERNAME = 'admin'
PROCESSOR_LEVEL = '15'
SYSTEMDRIVE = 'C:'
USERPROFILE = 'C:\Documents and Settings\admin'
PS1 = '\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
LOGONSERVER = '\\THORIN'
PROCESSOR_ARCHITECTURE = 'x86'
SHLVL = '1'
COLORFGBG = '15;default;0'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
HOMEDRIVE = 'C:'
COMSPEC = 'C:\WINNT\system32\cmd.exe'
TMP = '/cygdrive/c/DOCUME~1/admin/LOCALS~1/Temp'
SYSTEMROOT = 'C:\WINNT'
PRINTER = '\\aragorn\hp LaserJet 1000'
CVS_RSH = '/bin/ssh'
PROCESSOR_REVISION = '0102'
MSDEVDIR = 'D:\Microsoft Visual Studio\Common\MSDev98'
PKG_CONFIG_PATH = '/usr/X11R6/lib/pkgconfig'
INFOPATH = '/usr/local/info:/usr/share/info:/usr/info:'
PROGRAMFILES = 'C:\Program Files'
DISPLAY = ':0'
NUMBER_OF_PROCESSORS = '1'
INCLUDE = 'D:\Microsoft Visual Studio\VC98\atl\include;D:\Microsoft Visual Studio\VC98\mfc\include;D:\Microsoft Visual Studio\VC98\include'
COMPUTERNAME = 'THORIN'
COLORTERM = 'rxvt-xpm'
_ = '/usr/bin/cygcheck'
POSIXLY_CORRECT = '1'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = '/cygdrive'
  cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = 'e:\cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = 'e:\cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = 'e:\cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd             N/A    N/A                    
c:  hd  NTFS      3906Mb  91% CP CS UN PA FC     
d:  hd  FAT       3913Mb  66% CP    UN           
e:  hd  FAT32     9725Mb  27% CP    UN           EXTRA
f:  hd  FAT        509Mb   1% CP    UN           
g:  cd             N/A    N/A                    
h:  net NTFS     27650Mb  95% CP CS    PA        msdn

e:\cygwin      /          system  binmode
e:\cygwin/bin  /usr/bin   system  binmode
e:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  system  binmode,cygdrive

Found: e:\cygwin\bin\awk.exe
Found: e:\cygwin\bin\bash.exe
Found: e:\cygwin\bin\cat.exe
Found: e:\cygwin\bin\cp.exe
Found: e:\cygwin\bin\cpp.exe
Not Found: crontab
Found: e:\cygwin\bin\find.exe
Found: e:\cygwin\bin\gcc.exe
Found: e:\cygwin\bin\gdb.exe
Found: e:\cygwin\bin\grep.exe
Found: e:\cygwin\bin\kill.exe
Found: e:\cygwin\bin\ld.exe
Found: e:\cygwin\bin\ls.exe
Found: e:\cygwin\bin\make.exe
Found: e:\cygwin\bin\mv.exe
Found: e:\cygwin\bin\patch.exe
Found: e:\cygwin\bin\perl.exe
Found: e:\cygwin\bin\rm.exe
Found: e:\cygwin\bin\sed.exe
Found: e:\cygwin\bin\ssh.exe
Found: e:\cygwin\bin\sh.exe
Found: e:\cygwin\bin\tar.exe
Found: e:\cygwin\bin\test.exe
Not Found: vi
Found: e:\cygwin\bin\vim.exe

    7k 2003/10/19 e:\cygwin\bin\cygcrypt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypt-0.dll" v0.0 ts=2003/10/19 15:57
   19k 2003/03/22 e:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/20 11:05
   28k 2003/07/20 e:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-3.dll" v0.0 ts=2003/7/20 15:58
   15k 2003/07/20 e:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 16:00
   21k 2001/06/20 e:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/21 1:09
   22k 2001/12/13 e:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 17:28
   37k 2003/08/10 e:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-2.dll" v0.0 ts=2003/8/11 5:50
   31k 2005/11/20 e:\cygwin\bin\cygintl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-3.dll" v0.0 ts=2005/11/20 10:04
   45k 2001/04/25 e:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 13:28
   26k 2001/04/25 e:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 13:27
  156k 2001/04/25 e:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 13:29
  226k 2001/04/25 e:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 13:17
   15k 2001/04/25 e:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 13:27
   35k 2002/01/09 e:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/9 14:03
   20k 2002/01/09 e:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/9 14:03
  175k 2002/01/09 e:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/9 14:03
  202k 2002/01/09 e:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/9 14:03
   12k 2002/01/09 e:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/9 14:03
   48k 2003/08/09 e:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
                  "cygform7.dll" v0.0 ts=2003/8/9 17:25
   29k 2003/08/09 e:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu7.dll" v0.0 ts=2003/8/9 17:25
  224k 2003/08/09 e:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses7.dll" v0.0 ts=2003/8/9 17:24
   19k 2003/08/09 e:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel7.dll" v0.0 ts=2003/8/9 17:24
   22k 2002/06/09 e:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpopt-0.dll" v0.0 ts=2002/6/9 13:45
   17k 2001/06/28 e:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/7 12:34
  108k 2001/06/28 e:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/7 12:34
   29k 2003/08/10 e:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2003/8/11 7:16
  148k 2003/08/10 e:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2003/8/11 7:16
   78k 2006/12/20 e:\cygwin\bin\cygmagic-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygmagic-1.dll" v0.0 ts=2006/12/20 19:25
   61k 2006/11/10 e:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz2-1.dll" v0.0 ts=2006/11/11 7:42
    7k 2006/10/22 e:\cygwin\bin\cygcharset-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygcharset-1.dll" v0.0 ts=2006/10/23 7:43
  161k 2006/11/15 e:\cygwin\bin\cygfontconfig-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygfontconfig-1.dll" v0.0 ts=2006/11/16 4:44
   19k 2006/11/19 e:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-4.dll" v0.0 ts=2006/11/19 16:18
    8k 2006/11/19 e:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm_compat-4.dll" v0.0 ts=2006/11/19 16:18
  976k 2006/10/22 e:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygiconv-2.dll" v0.0 ts=2006/10/23 7:44
   31k 2006/10/23 e:\cygwin\bin\cygintl-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-8.dll" v0.0 ts=2006/10/23 8:12
   48k 2003/08/10 e:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2003/8/11 7:58
   48k 2006/11/17 e:\cygwin\bin\cygjbig-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig-2.dll" v0.0 ts=2006/11/17 15:43
  124k 2006/11/09 e:\cygwin\bin\cygjpeg-62.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg-62.dll" v0.0 ts=2006/11/9 17:02
   24k 2006/12/15 e:\cygwin\bin\cygltdl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygltdl-3.dll" v0.0 ts=2006/12/15 11:29
  391k 2006/11/05 e:\cygwin\bin\cygMagick++-10.dll - os=4.0 img=1.0 sys=4.0
                  "cygMagick++-10.dll" v0.0 ts=2006/11/5 22:43
 1709k 2006/11/05 e:\cygwin\bin\cygMagick-10.dll - os=4.0 img=1.0 sys=4.0
                  "cygMagick-10.dll" v0.0 ts=2006/11/5 22:32
  697k 2006/11/05 e:\cygwin\bin\cygWand-10.dll - os=4.0 img=1.0 sys=4.0
                  "cygWand-10.dll" v0.0 ts=2006/11/5 22:41
  226k 2006/11/05 e:\cygwin\bin\cygpng12.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng12.dll" v0.0 ts=2006/11/6 7:32
  174k 2004/10/14 e:\cygwin\bin\cygexpat-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygexpat-0.dll" v0.0 ts=2004/10/14 16:34
   40k 2006/11/15 e:\cygwin\bin\cygform-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygform-8.dll" v0.0 ts=2006/11/15 15:06
   21k 2006/11/15 e:\cygwin\bin\cygmenu-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu-8.dll" v0.0 ts=2006/11/15 15:05
  895k 2004/04/28 e:\cygwin\bin\cygdb-4.2.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb-4.2.dll" v0.0 ts=2004/4/27 23:31
 1156k 2004/04/28 e:\cygwin\bin\cygdb_cxx-4.2.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb_cxx-4.2.dll" v0.0 ts=2004/4/27 23:35
  965k 2005/05/14 e:\cygwin\bin\cygdb-4.3.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb-4.3.dll" v0.0 ts=2005/5/14 20:37
 1240k 2005/05/14 e:\cygwin\bin\cygdb_cxx-4.3.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb_cxx-4.3.dll" v0.0 ts=2005/5/14 20:41
   67k 2006/11/15 e:\cygwin\bin\cygncurses++-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++-8.dll" v0.0 ts=2006/11/15 15:13
  237k 2006/11/15 e:\cygwin\bin\cygncurses-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses-8.dll" v0.0 ts=2006/11/15 15:02
 1249k 2005/12/30 e:\cygwin\bin\cygperl5_8.dll - os=4.0 img=1.0 sys=4.0
                  "cygperl5_8.dll" v0.0 ts=2005/12/30 9:48
  312k 2006/11/10 e:\cygwin\bin\cygtiff-5.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff-5.dll" v0.0 ts=2006/11/10 16:09
   12k 2003/02/17 e:\cygwin\bin\cygioperm-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygioperm-0.dll" v0.0 ts=2003/2/18 3:58
   12k 2006/11/15 e:\cygwin\bin\cygpanel-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel-8.dll" v0.0 ts=2006/11/15 15:04
   25k 2007/01/18 e:\cygwin\bin\cyghistory6.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory6.dll" v0.0 ts=2007/1/18 11:14
  154k 2007/01/18 e:\cygwin\bin\cygreadline6.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline6.dll" v0.0 ts=2007/1/18 11:14
  314k 2005/08/10 e:\cygwin\bin\cygwmf-0-2-7.dll - os=4.0 img=1.0 sys=4.0
                  "cygwmf-0-2-7.dll" v0.0 ts=2005/8/10 21:54
  150k 2005/08/10 e:\cygwin\bin\cygwmflite-0-2-7.dll - os=4.0 img=1.0 sys=4.0
                  "cygwmflite-0-2-7.dll" v0.0 ts=2005/8/10 21:53
   20k 2006/12/21 e:\cygwin\bin\cygminires.dll - os=4.0 img=1.1 sys=4.0
                  "cygminires.dll" v0.0 ts=2006/12/21 13:07
  241k 2004/08/06 e:\cygwin\bin\cygjasper-1-701-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjasper-1-701-1.dll" v0.0 ts=2004/8/6 23:17
  156k 2005/08/08 e:\cygwin\bin\cyglcms-1.dll - os=4.0 img=1.0 sys=4.0
                  "cyglcms-1.dll" v0.0 ts=2005/8/8 18:15
  859k 2005/08/08 e:\cygwin\bin\cygfpx-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygfpx-1.dll" v0.0 ts=2005/8/9 5:35
  375k 2005/09/06 e:\cygwin\bin\cygfreetype-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygfreetype-6.dll" v0.0 ts=2005/9/7 6:51
  351k 2004/07/17 e:\cygwin\bin\cygGraphicsMagick++-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygGraphicsMagick++-0.dll" v0.0 ts=2004/7/17 16:48
 2170k 2004/07/17 e:\cygwin\bin\cygGraphicsMagick-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygGraphicsMagick-0.dll" v0.0 ts=2004/7/17 16:46
  369k 2004/08/11 e:\cygwin\bin\cygMagick++-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygMagick++-6.dll" v0.0 ts=2004/8/11 14:04
 3214k 2004/08/11 e:\cygwin\bin\cygMagick-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygMagick-6.dll" v0.0 ts=2004/8/11 13:37
  154k 2004/08/11 e:\cygwin\bin\cygWand-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygWand-6.dll" v0.0 ts=2004/8/11 14:04
  282k 2003/08/11 e:\cygwin\bin\cygtiff4.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff4.dll" v0.0 ts=2003/8/11 10:32
 1053k 2006/10/04 e:\cygwin\bin\cygcrypto-0.9.8.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypto-0.9.8.dll" v0.0 ts=2006/10/4 20:45
  215k 2006/10/04 e:\cygwin\bin\cygssl-0.9.8.dll - os=4.0 img=1.0 sys=4.0
                  "cygssl-0.9.8.dll" v0.0 ts=2006/10/4 20:45
 1125k 2006/10/04 e:\cygwin\bin\cygcrypto-0.9.7.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypto-0.9.7.dll" v0.0 ts=2006/10/4 20:12
  231k 2006/10/04 e:\cygwin\bin\cygssl-0.9.7.dll - os=4.0 img=1.0 sys=4.0
                  "cygssl-0.9.7.dll" v0.0 ts=2006/10/4 20:12
  802k 2003/09/15 e:\cygwin\bin\cygaspell-15.dll - os=4.0 img=1.0 sys=4.0
                  "cygaspell-15.dll" v0.0 ts=2003/9/15 20:32
  228k 2005/08/15 e:\cygwin\bin\cygt1-5.dll - os=4.0 img=1.0 sys=4.0
                  "cygt1-5.dll" v0.0 ts=2005/8/15 22:44
   65k 2006/10/16 e:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2006/10/16 9:10
  109k 2006/02/10 e:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre-0.dll" v0.0 ts=2006/2/10 10:37
  299k 2006/02/10 e:\cygwin\bin\cygpcrecpp-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcrecpp-0.dll" v0.0 ts=2006/2/10 10:38
    7k 2006/02/10 e:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix-0.dll" v0.0 ts=2006/2/10 10:37
 1065k 2006/06/09 e:\cygwin\bin\cygxml2-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygxml2-2.dll" v0.0 ts=2006/6/10 3:10
 1829k 2006/12/19 e:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2006/12/19 17:52
    Cygwin DLL version info:
        DLL version: 1.5.23
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 156
        Shared data: 4
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix: 
        Build date: Tue Dec 19 10:52:28 CET 2006
        CVS tag: cr-0x5f1
        Shared id: cygwin1S4

  140k 2004/08/06 e:\cygwin\usr\X11R6\bin\cygglut-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygglut-3.dll" v0.0 ts=2004/8/6 22:43
   56k 2004/03/11 e:\cygwin\usr\X11R6\bin\cygXft-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXft-1.dll" v0.0 ts=2003/11/18 9:42
   63k 2004/03/23 e:\cygwin\usr\X11R6\bin\cygXft-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygXft-2.dll" v0.0 ts=2004/3/24 6:20
   34k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygFS-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygFS-6.dll" v0.0 ts=2005/10/27 1:52
  357k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygGL-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygGL-1.dll" v0.0 ts=2005/10/27 2:30
  441k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygGLU-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygGLU-1.dll" v0.0 ts=2005/10/27 2:48
   74k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygICE-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygICE-6.dll" v0.0 ts=2005/10/27 1:11
 1662k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygOSMesa-4.dll - os=4.0 img=1.0 sys=4.0
                  "cygOSMesa-4.dll" v0.0 ts=2005/10/27 2:32
   28k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygSM-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygSM-6.dll" v0.0 ts=2005/10/27 1:12
  884k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygX11-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygX11-6.dll" v0.0 ts=2005/10/27 1:07
    7k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXRes-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXRes-1.dll" v0.0 ts=2005/10/27 3:00
   27k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXTrap-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXTrap-6.dll" v0.0 ts=2005/10/27 3:00
    8k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXau-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXau-6.dll" v0.0 ts=2005/10/27 0:31
  250k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXaw-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXaw-6.dll" v0.0 ts=2005/10/27 1:33
  354k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXaw-7.dll - os=4.0 img=1.0 sys=4.0
                  "cygXaw-7.dll" v0.0 ts=2005/10/27 1:39
  360k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXaw-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygXaw-8.dll" v0.0 ts=2005/10/27 1:45
    7k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXcomposite-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXcomposite-1.dll" v0.0 ts=2005/10/27 3:04
   30k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXcursor-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXcursor-1.dll" v0.0 ts=2005/10/27 3:03
    8k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXdamage-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXdamage-1.dll" v0.0 ts=2005/10/27 3:02
   16k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXdmcp-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXdmcp-6.dll" v0.0 ts=2005/10/27 0:34
    7k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXevie-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXevie-1.dll" v0.0 ts=2005/10/27 3:01
   50k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXext-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXext-6.dll" v0.0 ts=2005/10/27 1:14
   15k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXfixes-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygXfixes-3.dll" v0.0 ts=2005/10/27 3:02
   38k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygxrx-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygxrx-6.dll" v0.0 ts=2005/10/27 4:13
   26k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXi-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXi-6.dll" v0.0 ts=2005/10/27 1:48
   74k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXmu-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXmu-6.dll" v0.0 ts=2005/10/27 1:22
   10k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXmuu-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXmuu-1.dll" v0.0 ts=2005/10/27 1:23
   26k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXp-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXp-6.dll" v0.0 ts=2005/10/27 1:27
   54k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXpm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-4.dll" v0.0 ts=2005/10/27 1:26
   10k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXrandr-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygXrandr-2.dll" v0.0 ts=2005/10/27 2:58
   30k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXrender-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygXrender-1.dll" v0.0 ts=2005/10/27 2:52
  283k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXt-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXt-6.dll" v0.0 ts=2005/10/27 1:19
   17k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygXtst-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygXtst-6.dll" v0.0 ts=2005/10/27 1:49
   20k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygfontenc-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygfontenc-1.dll" v0.0 ts=2005/10/27 3:14
    8k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygoldX-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygoldX-6.dll" v0.0 ts=2005/10/27 1:09
  121k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygxkbfile-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygxkbfile-1.dll" v0.0 ts=2005/10/27 1:54
   11k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygxkbui-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygxkbui-1.dll" v0.0 ts=2005/10/27 1:54
   24k 2005/10/27 e:\cygwin\usr\X11R6\bin\cygxrxnest-6.dll - os=4.0 img=1.0 sys=4.0
                  "cygxrxnest-6.dll" v0.0 ts=2005/10/27 4:14
   26k 2005/09/21 e:\cygwin\usr\X11R6\bin\cygDtPrint-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygDtPrint-1.dll" v0.0 ts=2005/9/22 7:31
   74k 2005/09/21 e:\cygwin\usr\X11R6\bin\cygMrm-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygMrm-2.dll" v0.0 ts=2005/9/22 7:30
   63k 2005/09/21 e:\cygwin\usr\X11R6\bin\cygUil-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygUil-2.dll" v0.0 ts=2005/9/22 7:31
 1185k 2005/09/21 e:\cygwin\usr\X11R6\bin\cygXm-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygXm-2.dll" v0.0 ts=2005/9/22 7:27

Service             : cygserver
Current State       : Stopped
Command             : /usr/sbin/cygserver.exe
stdin path          : /dev/null
stdout path         : /var/log/cygserver.log
stderr path         : /var/log/cygserver.log
Process Type        : Own Process
Startup             : Disabled
Account             : LocalSystem

Service             : deler
Current State       : Stopped
Command             : /cygdrive/c/a.exe
stdin path          : /dev/null
stdout path         : /var/log/deler.log
stderr path         : /var/log/deler.log
Process Type        : Own Process
Startup             : Disabled
Account             : LocalSystem

Service             : httpd
Display name        : CYGWIN httpd (apache)
Current State       : Stopped
Command             : /usr/sbin/httpd.exe -F
stdin path          : /dev/null
stdout path         : /var/log/httpd.log
stderr path         : /var/log/httpd.log
Process Type        : Own Process
Startup             : Disabled
Account             : LocalSystem

Service             : postgresql
Current State       : Stopped
Command             : /usr/bin/postmaster -D /var/postgresql/data -i
stdin path          : /dev/null
stdout path         : /var/log/postgresql.log
stderr path         : /var/log/postgresql.log
Special flags       : --shutdown 
Termination Signal  : Interrupt
Environment         : CYGWIN="server" 
Process Type        : Own Process
Startup             : Disabled
Dependencies        : cygserver
Account             : .\admin


Cygwin Package Information
Last downloaded files to: d:\cyg-installer
Last downloaded files from: http://kementari/ftp/pub/mirrors/cygwin/

Package              Version
_update-info-dir     00494-1
alternatives         1.3.29a-1
ash                  20040127-3
aspell               0.50.3-1
aspell-en            0.51.0-1
autoconf             4-1
autoconf2.1          2.13-3
autoconf2.5          2.61-1
automake             2-1
automake1.10         1.10-1
automake1.4          1.4p6-4
automake1.5          1.5-2
automake1.6          1.6.3-3
automake1.7          1.7.9-3
automake1.8          1.8.5-3
automake1.9          1.9.6-2
base-files           3.7-1
base-passwd          2.2-1
bash                 3.2.9-10
bashdb               3.1_0.07-1
bc                   1.06-2
binutils             20060817-1
bzip2                1.0.3-2
coreutils            6.7-2
crypt                1.1-1
cvs                  1.11.22-1
cygrunsrv            1.17-1
cygutils             1.3.1-1
cygwin               1.5.23-2
cygwin-doc           1.4-4
diffutils            2.8.7-1
doxygen              1.5.1-1
e2fsprogs            1.35-3
editrights           1.01-1
expat                1.95.8-1
file                 4.19-1
findutils            4.3.2-3
fontconfig           2.4.1-4
fortune              1.99.1-2
freeglut             2.2.0-1
freetype2            2.1.9-1
gawk                 3.1.5-4
gcc                  3.4.4-3
gcc-core             3.4.4-3
gcc-g++              3.4.4-3
gcc-mingw-core       20050522-1
gcc-mingw-g++        20050522-1
gdb                  20060706-2
gdbm                 1.8.3-8
gettext              0.15-1
ghostscript-base     8.50-1
GraphicsMagick       1.0.6-1
grep                 2.5.1a-2
groff                1.18.1-2
gzip                 1.3.9-1
hexedit              1.2.10-1
ImageMagick          6.3.0.1-2
inetutils            1.3.2-35
ioperm               0.4-1
jasper               1.701.0-1
jbigkit              1.6-1
lcms                 1.14-1
less                 381-1
lesstif              0.94.4-1
libaspell15          0.50.3-1
libbz2_1             1.0.3-2
libcharset1          1.11-1
libdb4.2             4.2.52-1
libdb4.3             4.3.28-1
libfontconfig-devel  2.4.1-4
libfontconfig1       2.4.1-4
libfpx               1.2.0.12-1
libfreetype2-devel   2.1.9-1
libfreetype26        2.1.9-1
libgc                6.4-1
libgdbm              1.8.0-5
libgdbm-devel        1.8.3-8
libgdbm3             1.8.3-3
libgdbm4             1.8.3-8
libGraphicsMagick0   1.0.6-1
libiconv             1.11-1
libiconv2            1.11-1
libintl              0.10.38-3
libintl1             0.10.40-1
libintl2             0.12.1-3
libintl3             0.14.5-1
libintl8             0.15-1
libjbig1             1.5-3
libjbig2             1.6-1
libjpeg62            6b-12
libltdl3             1.5.23a-2
libMagick10          6.3.0.1-2
libMagick6           6.0.4-1
libncurses5          5.2-1
libncurses6          5.2-8
libncurses7          5.3-4
libncurses8          5.5-3
libpcre0             6.6-1
libpng12             1.2.12-1
libpopt0             1.6.4-4
libreadline4         4.1-2
libreadline5         4.3-5
libreadline6         5.2.1-6
libtiff4             3.6.0-5
libtiff5             3.8.2-3
libtool1.5           1.5.23a-2
libwmf               0.2.8.4-1
libXft               2.1.6-1
libXft-devel         2.1.6-1
libXft1              1.0.0-1
libXft2              2.1.6-1
libxml2              2.6.26-1
links                0.99pre14-1
login                1.9-7
lynx                 2.8.5-4
m4                   1.4.8-1
make                 3.81-1
man                  1.6d-2
mingw-runtime        3.11-1
minires              1.01-1
mktemp               1.5-4
ncftp                3.2.0-1
ncurses              5.5-3
netcat               1.10-2
openssh              4.5p1-1
openssl              0.9.8d-1
openssl097           0.9.7l-1
patch                2.5.8-8
patchutils           0.2.31-1
pcre                 6.6-1
pcre-devel           6.6-1
pcre-doc             6.6-1
perl                 5.8.7-5
rsync                2.6.6-1
run                  1.1.10-1
rxvt                 20050409-4
sed                  4.1.5-2
sharutils            4.6.3-1
t1lib                5.1.0-1
tar                  1.16.1-1
tcltk                20060202-1
termcap              20050421-1
terminfo             5.5_20061104-1
texinfo              4.8-3
unzip                5.52-2
util-linux           2.12r-2
vim                  7.0.122-1
w32api               3.8-1
w3m                  0.5.1-1
wget                 1.10.2-2
which                1.7-1
X-startup-scripts    1.0.11-1
xinetd               2.3.9-1
xorg-x11-base        6.8.99.901-1
xorg-x11-bin         6.8.99.901-1
xorg-x11-bin-dlls    6.8.99.901-1
xorg-x11-bin-lndir   6.8.99.901-1
xorg-x11-devel       6.8.99.901-1
xorg-x11-etc         6.8.99.901-1
xorg-x11-fenc        6.8.99.901-1
xorg-x11-fnts        6.8.99.901-1
xorg-x11-libs-data   6.8.99.901-1
xorg-x11-xwin        6.8.99.901-1
xpdf                 3.01-2
xterm                202-1
zip                  2.32-2
zlib                 1.2.3-2
Use -h to see help about each section
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include <windows.h>

/*
    timeval_subtract() code taken from the GLIBC docs at gnu.org 
    http://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html
*/

int timeval_subtract (struct timeval *result, struct timeval *x,
    struct timeval *y)
{
    int nsec;

    /* Perform the carry for the later subtraction by updating y. */
    if (x->tv_usec < y->tv_usec)
    {
        nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
        y->tv_usec -= 1000000 * nsec;
        y->tv_sec += nsec;
    }

    if (x->tv_usec - y->tv_usec > 1000000)
    {
        nsec = (x->tv_usec - y->tv_usec) / 1000000;
        y->tv_usec += 1000000 * nsec;
        y->tv_sec -= nsec;
    }

    /* Compute the time remaining to wait.
    tv_usec is certainly positive. */
    result->tv_sec = x->tv_sec - y->tv_sec;
    result->tv_usec = x->tv_usec - y->tv_usec;

    /* Return 1 if result is negative. */
    return x->tv_sec < y->tv_sec;
}

int main()
{
    struct timeval tv1, tv2, result;
    int x;
   
    /* let's put our calibration parameters here */
    /* Let's cache usleep (if there is such a thing).  It seems the first call 
       to usleep takes longer than the rest. */
    usleep(0);

    printf("Print elapsed time at every call to usleep()\n");
    for (x = 0; x < 10; x++)
    {
        gettimeofday(&tv1, NULL);
        usleep(100000);
        gettimeofday(&tv2, NULL);
        timeval_subtract(&result, &tv2, &tv1);
        printf("Elapsed time (sec:microsec) %d:%d\n", result.tv_sec,
            result.tv_usec);
    }

    printf("\n");

    printf("Print elapsed after the loop()\n");
    gettimeofday(&tv1, NULL);
    for (x = 0; x < 10; x++)
    {
        usleep(100000);
    }
    gettimeofday(&tv2, NULL);
        printf("Elapsed time (sec:microsec) %d:%d\n", result.tv_sec,
            result.tv_usec);
    timeval_subtract(&result, &tv2, &tv1);

    return 0;
}


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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