let rec passive_time (t: t) =
let continue history =
passive_time (history.previous_state :> t)
in
match t with
| `Building history -> continue history
| `Tried_to_start (history, _) -> continue history
| `Started_running (history, _) -> continue history
| `Starting history -> continue history
| `Still_building history -> continue history
| `Still_running (history, _) -> continue history
| `Still_running_despite_recoverable_error (_, history, _) -> continue history
| `Ran_successfully (history, _) -> continue history
| `Successfully_did_nothing history -> continue history
| `Active (history, _) -> continue history
| `Tried_to_eval_condition history -> continue history
| `Tried_to_reeval_condition (_, history) -> continue history
| `Verified_success history -> continue history
| `Already_done history -> continue history
| `Dependencies_failed (history, _) -> continue history
| `Failed_running (history, _, _) -> continue history
| `Failed_to_kill history -> continue history
| `Failed_to_eval_condition history -> continue history
| `Failed_to_start (history, _) -> continue history
| `Killing history -> continue history
| `Tried_to_kill history -> continue history
| `Did_not_ensure_condition history -> continue history
| `Killed history -> continue history
| `Finished history -> continue history
| `Passive log -> log.time