<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioTime"
  },
  "title" : "AVAudioTime"
}
-->

# AVAudioTime

An object you use to represent a moment in time.

```
class AVAudioTime
```

## Overview

The `AVAudioTime` object represents a single moment in time in two ways:

- As host time, using the system’s basic clock with `mach_absolute_time()`
- As audio samples at a particular sample rate

A single `AVAudioTime` instance contains either or both representations, meaning it might represent only a sample time, a host time, or both.

Instances of this class are immutable.

## Topics

### Creating an Audio Time Instance

[`init(audioTimeStamp:sampleRate:)`](/documentation/AVFAudio/AVAudioTime/init(audioTimeStamp:sampleRate:))

Creates an audio time object with the specified timestamp and sample rate.

[`init(hostTime:)`](/documentation/AVFAudio/AVAudioTime/init(hostTime:))

Creates an audio time object with the specified host time.

[`init(hostTime:sampleTime:atRate:)`](/documentation/AVFAudio/AVAudioTime/init(hostTime:sampleTime:atRate:))

Creates an audio time object with the specified host time, sample time, and sample rate.

[`init(sampleTime:atRate:)`](/documentation/AVFAudio/AVAudioTime/init(sampleTime:atRate:))

Creates an audio time object with the specified timestamp and sample rate.

[`timeWithAudioTimeStamp:sampleRate:`](/documentation/AVFAudio/AVAudioTime/timeWithAudioTimeStamp:sampleRate:)

Creates an audio time object with the specified timestamp and sample rate.

[`timeWithHostTime:sampleTime:atRate:`](/documentation/AVFAudio/AVAudioTime/timeWithHostTime:sampleTime:atRate:)

Creates an audio time object with the specified host time, sample time, and sample rate.

[`timeWithSampleTime:atRate:`](/documentation/AVFAudio/AVAudioTime/timeWithSampleTime:atRate:)

Creates an audio time object with the specified sample time and sample rate.

[`timeWithHostTime:`](/documentation/AVFAudio/AVAudioTime/timeWithHostTime:)

Creates an audio time object with the specified host time.

[`extrapolateTime(fromAnchor:)`](/documentation/AVFAudio/AVAudioTime/extrapolateTime(fromAnchor:))

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

### Manipulating Host Time

[`hostTime`](/documentation/AVFAudio/AVAudioTime/hostTime)

The host time.

[`isHostTimeValid`](/documentation/AVFAudio/AVAudioTime/isHostTimeValid)

A Boolean value that indicates whether the host time value is valid.

[`hostTime(forSeconds:)`](/documentation/AVFAudio/AVAudioTime/hostTime(forSeconds:))

Converts seconds to host time.

[`seconds(forHostTime:)`](/documentation/AVFAudio/AVAudioTime/seconds(forHostTime:))

Converts host time to seconds.

### Getting Sample Rate Information

[`sampleRate`](/documentation/AVFAudio/AVAudioTime/sampleRate)

The sampling rate that the sample time property expresses.

[`sampleTime`](/documentation/AVFAudio/AVAudioTime/sampleTime)

The time as a number of audio samples that the current audio device tracks.

[`isSampleTimeValid`](/documentation/AVFAudio/AVAudioTime/isSampleTimeValid)

A Boolean value that indicates whether the sample time and sample rate properties are in a valid state.

### Getting the Core Audio Time Stamp

[`audioTimeStamp`](/documentation/AVFAudio/AVAudioTime/audioTimeStamp)

The time as an audio timestamp.



---

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)