Update to mtime.1.0

This commit is contained in:
Grégoire Henry 2017-07-17 15:56:30 +02:00
parent b8ccfeb0cf
commit 571e87dacb
5 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ PKG ipv6-multicast
PKG irmin PKG irmin
PKG lwt PKG lwt
PKG magic-mime PKG magic-mime
PKG mtime.os PKG mtime.clock.os
PKG nocrypto PKG nocrypto
PKG ocplib-endian PKG ocplib-endian
PKG ocplib-json-typed PKG ocplib-json-typed

View File

@ -121,7 +121,7 @@ UTILS_PACKAGES := \
ezjsonm \ ezjsonm \
ipaddr.unix \ ipaddr.unix \
lwt.unix \ lwt.unix \
mtime.os \ mtime.clock.os \
nocrypto \ nocrypto \
sodium \ sodium \
zarith \ zarith \

View File

@ -272,11 +272,11 @@ module Identity = struct
Format.fprintf ppf "%s%!" init ; Format.fprintf ppf "%s%!" init ;
let count = ref 10000 in let count = ref 10000 in
let rec loop n = let rec loop n =
let start = Mtime.counter () in let start = Mtime_clock.counter () in
Format.fprintf ppf "%s%!" animation.(n mod animation_size); Format.fprintf ppf "%s%!" animation.(n mod animation_size);
try generate ~max:!count target try generate ~max:!count target
with Not_found -> with Not_found ->
let time = Mtime.to_ms (Mtime.count start) in let time = Mtime.Span.to_ms (Mtime_clock.count start) in
count := count :=
if time <= 0. then if time <= 0. then
!count * 10 !count * 10

View File

@ -28,7 +28,7 @@ depends: [
"lwt" {>= "3.0.0" } "lwt" {>= "3.0.0" }
"lwt_ssl" "lwt_ssl"
"menhir" "menhir"
"mtime" "mtime" { >= "1.0.0" }
"ocp-ocamlres" {>= "dev" } "ocp-ocamlres" {>= "dev" }
"ocplib-endian" "ocplib-endian"
"ocplib-json-typed" "ocplib-json-typed"

View File

@ -31,12 +31,12 @@ let update_hook = ref []
let on_update f = update_hook := f :: !update_hook let on_update f = update_hook := f :: !update_hook
let worker_loop () = let worker_loop () =
let prev = ref @@ Mtime.elapsed () in let prev = ref @@ Mtime_clock.elapsed () in
let rec inner sleep = let rec inner sleep =
sleep >>= fun () -> sleep >>= fun () ->
let sleep = Lwt_unix.sleep 1. in let sleep = Lwt_unix.sleep 1. in
let now = Mtime.elapsed () in let now = Mtime_clock.elapsed () in
let elapsed = int_of_float (Mtime.(to_ms now -. to_ms !prev)) in let elapsed = int_of_float (Mtime.Span.(to_ms now -. to_ms !prev)) in
prev := now; prev := now;
Inttbl.iter Inttbl.iter
(fun _ c -> (fun _ c ->