---
title: "extrapolateTime(fromAnchor:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudiotime/extrapolatetime(fromanchor:)"
---

# extrapolateTime(fromAnchor:)

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

## Declaration

```swift
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

Return Value A new AVAudioTime instance.

## Discussion

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. // 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];

## See Also

### Creating an Audio Time Instance

- [init(audioTimeStamp:sampleRate:)](avfaudio/avaudiotime/init(audiotimestamp:samplerate:).md)
- [init(hostTime:)](avfaudio/avaudiotime/init(hosttime:).md)
- [init(hostTime:sampleTime:atRate:)](avfaudio/avaudiotime/init(hosttime:sampletime:atrate:).md)
- [init(sampleTime:atRate:)](avfaudio/avaudiotime/init(sampletime:atrate:).md)
