---
title: masterClock
framework: avfoundation
role: symbol
role_heading: Instance Property
path: avfoundation/avcapturesession/masterclock
---

# masterClock

A clock object used for output synchronization.

## Declaration

```swift
var masterClock: CMClock? { get }
```

## Discussion

Discussion The returned CMClock object is read-only and provides a timebase for all sample buffers in capture output. Use this clock in conjunction with the clock from an AVCaptureInput.Port object to synchronize capture output with external data sources such as motion samples. For example, to synchronize output timestamps to the original timestamps provided by an input device, you can do the following in your fileOutput(_:didOutputSampleBuffer:from:) method: guard let masterClock = captureSession.masterClock,     let originalClock = connection.inputPorts.first?.clock else { return }

let synchedPTS = sampleBuffer.presentationTimeStamp let originalPTS = masterClock.convertTime(synchedPTS, to: originalClock) This property is key-value observable.

## See Also

### Synchronizing output

- [synchronizationClock](avfoundation/avcapturesession/synchronizationclock.md)
