* [Caml-list] How to make a delay ?
@ 2001-08-17 9:15 José Romildo Malaquias
2001-08-17 9:39 ` Daniel de Rauglaudre
2001-08-17 10:00 ` Markus Mottl
0 siblings, 2 replies; 3+ messages in thread
From: José Romildo Malaquias @ 2001-08-17 9:15 UTC (permalink / raw)
To: caml-list
Hello.
I am need to control the time under a program I am writing,
in order to simulate a real-time situation. I just need
a function that suspends the program execution for a
given time, in miliseconds precision.
Any help?
Romildo
--
Prof. José Romildo Malaquias <romildo@uber.com.br> <romildo@iceb.ufop.br>
Departamento de Computação - Universidade Federal de Ouro Preto
Brasil
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] How to make a delay ?
2001-08-17 9:15 [Caml-list] How to make a delay ? José Romildo Malaquias
@ 2001-08-17 9:39 ` Daniel de Rauglaudre
2001-08-17 10:00 ` Markus Mottl
1 sibling, 0 replies; 3+ messages in thread
From: Daniel de Rauglaudre @ 2001-08-17 9:39 UTC (permalink / raw)
To: caml-list
Hi,
On Fri, Aug 17, 2001 at 06:15:34AM -0300, José Romildo Malaquias wrote:
> I am need to control the time under a program I am writing,
> in order to simulate a real-time situation. I just need
> a function that suspends the program execution for a
> given time, in miliseconds precision.
Unix.select [] [] [] your_timeout
--
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] How to make a delay ?
2001-08-17 9:15 [Caml-list] How to make a delay ? José Romildo Malaquias
2001-08-17 9:39 ` Daniel de Rauglaudre
@ 2001-08-17 10:00 ` Markus Mottl
1 sibling, 0 replies; 3+ messages in thread
From: Markus Mottl @ 2001-08-17 10:00 UTC (permalink / raw)
To: caml-list
On Fri, 17 Aug 2001, Jos? Romildo Malaquias wrote:
> I am need to control the time under a program I am writing, in order
> to simulate a real-time situation. I just need a function that suspends
> the program execution for a given time, in miliseconds precision.
You can use timers and signals to do this, e.g.:
---------------------------------------------------------------------------
open Sys
open Unix
open Printf
let _ =
set_signal sigalrm (Signal_handle (fun _ -> ()));
let timer = 3.14159 in
let expected_time = gettimeofday () +. timer in
ignore (setitimer ITIMER_REAL { it_interval = 0.0; it_value = timer });
pause ();
printf "Precision: %f\n" (abs_float (gettimeofday () -. expected_time))
---------------------------------------------------------------------------
Depending on the type and load of your system, you can achieve precision
in the range of milliseconds.
Regards,
Markus Mottl
--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-08-17 10:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-17 9:15 [Caml-list] How to make a delay ? José Romildo Malaquias
2001-08-17 9:39 ` Daniel de Rauglaudre
2001-08-17 10:00 ` Markus Mottl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox