Skip to content

Commit

Permalink
Use Mtime.Span.to_float_ns instead of Mtime.Span.to_uint64_ns+Int64.t…
Browse files Browse the repository at this point in the history
…o_float (#6211)

Minor code reduction.
  • Loading branch information
lindig authored Jan 9, 2025
2 parents 53a081c + e68cda7 commit 96f7cd1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ocaml/libs/xapi-stdext/lib/xapi-stdext-threads/scheduler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ let lock = Mutex.create ()
module Clock = struct
let span s = Mtime.Span.of_uint64_ns (Int64.of_float (s *. 1e9))

let span_to_s span =
Mtime.Span.to_uint64_ns span |> Int64.to_float |> fun ns -> ns /. 1e9
let span_to_s span = Mtime.Span.to_float_ns span |> fun ns -> ns /. 1e9

let add_span clock secs =
(* return mix or max available value if the add overflows *)
Expand Down

0 comments on commit 96f7cd1

Please sign in to comment.