<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 15.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAudio",
  "identifier" : "/documentation/CoreAudio/AudioHardwareDevice/nearestStartTime(atTime:withFlags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Audio"
    ],
    "preciseIdentifier" : "s:9CoreAudio0B14HardwareDeviceC16nearestStartTime02atG09withFlagsSo0bG5StampVAH_s6UInt32VtKF"
  },
  "title" : "nearestStartTime(atTime:withFlags:)"
}
-->

# nearestStartTime(atTime:withFlags:)

Query the device to get a time equal to or later than the given time that is the best time
to start IO.

```
func nearestStartTime(atTime timestamp: AudioTimeStamp, withFlags flags: UInt32 = 0) throws -> AudioTimeStamp
```

## Parameters

`timestamp`

An AudioTimeStamp containing the requested start time.

`flags`

A UInt32 containing flags that modify how this function behaves.

## Return Value

An AudioTimeStamp containing a time equal to or later than the requested
time, as dictated by the device’s constraints.

## Discussion

The time that is returned is dictated by the constraints of the device and the system. For
instance, the driver of a device that provides both audio and video data may only allow
start times that coincide with the edge of a video frame. Also, if the device already has
one or more active IOProcs, the start time will be shifted to the beginning of the next IO
cycle so as not to cause discontinuities in the existing IOProcs. Another reason the start
time may shift is to allow for aligning the buffer accesses in an optimal fashion. Note
that the device must be running to use this function.

---

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)