caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Thread.delay, Unix.select, Unix.gettimeofday, Sys.time together?
@ 2003-06-07 12:17 Nick Name
  2003-06-07 13:31 ` Nicolas George
  2003-06-09 16:19 ` Xavier Leroy
  0 siblings, 2 replies; 3+ messages in thread
From: Nick Name @ 2003-06-07 12:17 UTC (permalink / raw)
  To: caml-list

Hi all,

I have a cycle similar to the following in my program:

while true do 
	Thread.delay mydelay; 
	print_float Unix.gettimeofday (); 
	print_newline()
done

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. Is there a portable function that
can do a shorter delay, say 1/1000 of second ad least?

BTW, I have found a problem in using Sys.time and Thread.delay together:
if I DON'T use Thread.delay, Sys.time returns an increasing value, as
it's expected to. If I do a cycle like

while true do 
	Thread.delay mydelay; 
	print_float Sys.time (); 
	print_newline()
done

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.

If this might be a bug I'll do the bug report.

thanks for attention

Vincenzo

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-09 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-07 12:17 [Caml-list] Thread.delay, Unix.select, Unix.gettimeofday, Sys.time together? Nick Name
2003-06-07 13:31 ` Nicolas George
2003-06-09 16:19 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).