[OCaml] High Intensity Training Online
1
(** Recovery timing and explicit permission to train. *)
2
3
type timestamp = private int
4
5
val timestamp_of_unix_seconds : int -> timestamp
6
val timestamp_to_unix_seconds : timestamp -> int
7
8
type duration = private int
9
10
val hours : int -> duration
11
val days : int -> duration
12
val duration_to_seconds : duration -> int
13
14
val elapsed : since:timestamp -> now:timestamp -> duration
15
(** Zero when [now] precedes [since]. *)
16
17
val pp_duration : Format.formatter -> duration -> unit
18
19
type readiness =
20
| Ready
21
| Recovering of { rested : duration; recommended : duration }
22
23
val evaluate_readiness : elapsed:duration -> recommended:duration -> readiness
24
val is_ready : readiness -> bool
25
val pp_readiness : Format.formatter -> readiness -> unit
26
27
type clearance
28
(** Unforgeable permission: earned by recovery or explicitly overridden. *)
29
30
type basis =
31
| Recovered
32
| Overridden of { rested : duration; recommended : duration }
33
34
val clear : readiness -> clearance option
35
(** [Some] iff recovery is complete. *)
36
37
val override : readiness -> clearance
38
(** Records explicit training before recovery completes. *)
39
40
val basis : clearance -> basis
41