Update to mtime.1.0
This commit is contained in:
parent
b8ccfeb0cf
commit
571e87dacb
@ -36,7 +36,7 @@ PKG ipv6-multicast
|
||||
PKG irmin
|
||||
PKG lwt
|
||||
PKG magic-mime
|
||||
PKG mtime.os
|
||||
PKG mtime.clock.os
|
||||
PKG nocrypto
|
||||
PKG ocplib-endian
|
||||
PKG ocplib-json-typed
|
||||
|
@ -121,7 +121,7 @@ UTILS_PACKAGES := \
|
||||
ezjsonm \
|
||||
ipaddr.unix \
|
||||
lwt.unix \
|
||||
mtime.os \
|
||||
mtime.clock.os \
|
||||
nocrypto \
|
||||
sodium \
|
||||
zarith \
|
||||
|
@ -272,11 +272,11 @@ module Identity = struct
|
||||
Format.fprintf ppf "%s%!" init ;
|
||||
let count = ref 10000 in
|
||||
let rec loop n =
|
||||
let start = Mtime.counter () in
|
||||
let start = Mtime_clock.counter () in
|
||||
Format.fprintf ppf "%s%!" animation.(n mod animation_size);
|
||||
try generate ~max:!count target
|
||||
with Not_found ->
|
||||
let time = Mtime.to_ms (Mtime.count start) in
|
||||
let time = Mtime.Span.to_ms (Mtime_clock.count start) in
|
||||
count :=
|
||||
if time <= 0. then
|
||||
!count * 10
|
||||
|
@ -28,7 +28,7 @@ depends: [
|
||||
"lwt" {>= "3.0.0" }
|
||||
"lwt_ssl"
|
||||
"menhir"
|
||||
"mtime"
|
||||
"mtime" { >= "1.0.0" }
|
||||
"ocp-ocamlres" {>= "dev" }
|
||||
"ocplib-endian"
|
||||
"ocplib-json-typed"
|
||||
|
@ -31,12 +31,12 @@ let update_hook = ref []
|
||||
let on_update f = update_hook := f :: !update_hook
|
||||
|
||||
let worker_loop () =
|
||||
let prev = ref @@ Mtime.elapsed () in
|
||||
let prev = ref @@ Mtime_clock.elapsed () in
|
||||
let rec inner sleep =
|
||||
sleep >>= fun () ->
|
||||
let sleep = Lwt_unix.sleep 1. in
|
||||
let now = Mtime.elapsed () in
|
||||
let elapsed = int_of_float (Mtime.(to_ms now -. to_ms !prev)) in
|
||||
let now = Mtime_clock.elapsed () in
|
||||
let elapsed = int_of_float (Mtime.Span.(to_ms now -. to_ms !prev)) in
|
||||
prev := now;
|
||||
Inttbl.iter
|
||||
(fun _ c ->
|
||||
|
Loading…
Reference in New Issue
Block a user