1 (* Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
3 * Copyright (C
) 1997-2000 NEC Research Institute
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
9 structure MLtonItimer
=
11 structure Prim
= PrimitiveFFI
.MLton
.Itimer
13 datatype t
= Prof |
Real | Virtual
16 fn Prof
=> PosixSignal
.prof
17 |
Real => PosixSignal
.alrm
18 | Virtual
=> PosixSignal
.vtalrm
23 | Virtual
=> Prim
.VIRTUAL
25 fun set
' (t
, {interval
, value
}) =
29 val q
= LargeInt
.quot (Time
.toMicroseconds t
, 1000000)
30 val r
= LargeInt
.rem (Time
.toMicroseconds t
, 1000000)
32 (C_Time
.fromLargeInt q
, C_SUSeconds
.fromLargeInt r
)
34 val (s1
, u1
) = split interval
35 val (s2
, u2
) = split value
37 ignore (Prim
.set (toInt t
, s1
, u1
, s2
, u2
))
40 fun set (z
as (t
, _
)) =
41 if Primitive
.MLton
.Profile
.isOn