From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA32083; Sat, 7 Jun 2003 15:31:37 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA32043 for ; Sat, 7 Jun 2003 15:31:35 +0200 (MET DST) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h57DVZH19659 for ; Sat, 7 Jun 2003 15:31:35 +0200 (MET DST) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.12.9/1.01.28121999) with ESMTP id h57DVZOv007248 ; Sat, 7 Jun 2003 15:31:35 +0200 (CEST) Received: from (george@localhost) by clipper.ens.fr (8.12.3/jb-1.1) Date: Sat, 7 Jun 2003 15:31:34 +0200 From: Nicolas George To: caml-list@inria.fr Cc: Nick Name Subject: Re: [Caml-list] Thread.delay, Unix.select, Unix.gettimeofday, Sys.time together? Message-ID: <20030607133134.GA28903@clipper.ens.fr> Reply-To: caml-list@inria.fr References: <20030607141702.28d583c6.nick.name@inwind.it> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bp/iNruPH9dso1Pn" Content-Disposition: inline In-Reply-To: <20030607141702.28d583c6.nick.name@inwind.it> User-Agent: Mutt/1.4 X-Spam: no; 0.00; caml-list:01 gettimeofday:01 nonidi:01 shorter:01 slower:01 ecrit:01 nicolas:01 unix:02 thread:02 sys:03 burn:94 suspect:05 guess:06 ens:06 alpha:07 X-Attachments: type="application/pgp-signature" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Le nonidi 19 prairial, an CCXI, Nick Name a =E9crit=A0: > If I put the delay into the cycle, I can't get less than 1/100 of second > delay, on any machine I do this test. I guess you didn't try with Linux/alpha :) The 1/100 of second is the time slice of the scheduler of the OS. Anything that sleeps by calling the OS will sleep at least that. > Is there a portable function that > can do a shorter delay, say 1/1000 of second ad least? You need to do busy wait: keep running and check the clock until the delay is over. Please note that busy wait is considered evil. > Sys.time returns an almost constant value! This also happens if I use > Unix.select [] [] [] mydelay instead of Thread.delay. I suspect this > happens because some sort of counter gets reset by a delay, but this > makes no sense. The answer is in the manual: Sys.time returns the processor time of your program. While sleeping, your program does not burn CPU, so Sys.time does not grow. It will only grow during the phases between the sleeps, and this will be much slower than whithout sleep. --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (SunOS) iD8DBQE+4ek2sGPZlzblTJMRArUTAJ4gJIvrcm//CN9iuyhP4mXDMUYebgCgkLNC NxuFyr+/Brs9kTqqh9hCBKw= =uNbl -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners