diff --git a/ocaml/libs/clock/timer.ml b/ocaml/libs/clock/timer.ml index cadfa7688f1..6e6a1ef711c 100644 --- a/ocaml/libs/clock/timer.ml +++ b/ocaml/libs/clock/timer.ml @@ -1,4 +1,4 @@ -type t = {start: Ptime.t; elapsed: Mtime_clock.counter; duration: Mtime.Span.t} +type t = {elapsed: Mtime_clock.counter; duration: Mtime.Span.t} type countdown = Remaining of Mtime.Span.t | Expired of Mtime.Span.t @@ -6,8 +6,7 @@ let span_is_shorter a ~than:b = Mtime.Span.compare a b < 0 let span_is_longer a ~than:b = Mtime.Span.compare a b > 0 -let start ~duration = - {start= Ptime_clock.now (); elapsed= Mtime_clock.counter (); duration} +let start ~duration = {elapsed= Mtime_clock.counter (); duration} let duration {duration; _} = duration @@ -25,14 +24,6 @@ let has_expired t = let elapsed = Mtime_clock.count t.elapsed in not (span_is_shorter elapsed ~than:t.duration) -let deadline_of t = - Mtime.Span.to_uint64_ns t.duration - |> Int64.to_float - |> Ptime.Span.of_float_s - |> Option.get - |> Ptime.(Span.add Ptime.(to_span t.start)) - |> Ptime.Span.to_float_s - let shorten_by dur t = let duration = if span_is_longer dur ~than:t.duration then diff --git a/ocaml/libs/clock/timer.mli b/ocaml/libs/clock/timer.mli index 5f21d4692cd..8a60bb89382 100644 --- a/ocaml/libs/clock/timer.mli +++ b/ocaml/libs/clock/timer.mli @@ -24,12 +24,6 @@ val remaining : t -> countdown (** [remaining timer] returns the amount of time left until [timer] expires or the amount of time since it expired. *) -val deadline_of : t -> float -(** [deadline_of timer] returns the posix timestamp when the timer expires. - This is an approximation as the timer doesn't take leap seconds into - account when waiting. The use of this function is discouraged and it's - only provided for backwards-compatible reasons. *) - val shorten_by : Mtime.Span.t -> t -> t (** [shorten_by amount timer] creates a new timer with the duration of [timer] shortened by [amount]. The starting time doesn't change. The duration of a