<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioTime/extrapolateTime(fromAnchor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioTime(im)extrapolateTimeFromAnchor:"
  },
  "title" : "extrapolateTime(fromAnchor:)"
}
-->

# extrapolateTime(fromAnchor:)

Creates an audio time object by converting between host time and sample time.

```
func extrapolateTime(fromAnchor anchorTime: AVAudioTime) -> AVAudioTime?
```

## Parameters

`anchorTime`

An audio time instance with a more complete timestamp than that of the receiver (self).

## Return Value

A new [`AVAudioTime`](/documentation/AVFAudio/AVAudioTime) instance.

## Discussion

If `anchorTime` is an `AVAudioTime` instance where both host time and sample time are valid, and the receiver is another timestamp where only one of the two is valid, this method returns a new `AVAudioTime`. It copies it from the receiver, where the anchor provides additional valid fields.

The `anchorTime` value must have a valid host time and sample time, and self must have sample rate and at least one valid host time or sample time. Otherwise, this method returns `nil`.

```objc
// time0 has a valid audio sample representation, but no host time representation.
AVAudioTime *time0 = [AVAudioTime timeWithSampleTime: 0.0 atRate: 44100.0];
// anchor has a valid host time representation and sample time representation.
AVAudioTime *anchor = [node currentTime];
// fill in  valid host time representation
AVAudioTime *fullTime = [sampleTime extrapolateTimeFromAnchor: sampleTime];
```

---

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)