Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Thread.delay,, Unix.gettimeofday, Sys.time together?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-06-07 (12:15)
From: Nick Name <>
Subject: [Caml-list] Thread.delay,, Unix.gettimeofday, Sys.time together?
Hi all,

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

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

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 (); 

Sys.time returns an almost constant value! This also happens if I use [] [] [] 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


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: