<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/cp_frame_timing_get_optimal_input_time",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Compositor Services"
    ],
    "preciseIdentifier" : "c:@F@cp_frame_timing_get_optimal_input_time"
  },
  "title" : "cp_frame_timing_get_optimal_input_time"
}
-->

# cp_frame_timing_get_optimal_input_time

Returns the optimal time to start the frame submission process.

```
cp_time_t cp_frame_timing_get_optimal_input_time(cp_frame_timing_t frame_timing);
```

## Parameters

`frame_timing`

The frame’s timing information.
Fetch this information using the [`cp_frame_predict_timing`](/documentation/CompositorServices/cp_frame_predict_timing) function.
After you retrieve the frame’s drawable type, get the information using
[`frameTiming`](/documentation/CompositorServices/LayerRenderer/Drawable/frameTiming) instead.

## Return Value

The Mach absolute time at which to query the input for your frame.

## Discussion

The optimal input time is the time at which to call the [`startSubmission()`](/documentation/CompositorServices/LayerRenderer/Frame/startSubmission()) function.
Use the time before the input time to update your app’s data structures and prepare for rendering.
Call [`cp_time_wait_until`](/documentation/CompositorServices/cp_time_wait_until) to suspend your app until the optimal time arrives.
When it does, fetch the current device pose and finish rendering and the frame and commit your Metal command buffers.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)