---
title: "CMSyncGetRelativeRate(_:relativeTo:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsyncgetrelativerate(_:relativeto:)"
---

# CMSyncGetRelativeRate(_:relativeTo:)

Returns the relative rate of one timebase or clock relative to another timebase or clock.

## Declaration

```swift
func CMSyncGetRelativeRate(_ ofClockOrTimebase: CMClockOrTimebase, relativeTo relativeToClockOrTimebase: CMClockOrTimebase) -> Float64
```

## Discussion

Discussion If both have a common host, the function syncs the clock or timebase based on the rates in the common tree rooted in that host. If they have different host clocks (or are both clocks), this calculation takes into account the measured drift between the two clocks, using host time as a pivot. The rate of a moving timebase relative to a stopped timebase is a NaN. Calling CMTimebaseGetEffectiveRate(timebase) is equivalent to calling CMSyncGetRelativeRate(timebase, CMTimebaseGetUltimateMasterClock(timebase)).

## See Also

### Getting and Syncing Time

- [CMSyncGetTime(_:)](coremedia/cmsyncgettime(_:).md)
- [CMSyncGetRelativeRateAndAnchorTime(_:relativeTo:relativeRateOut:anchorTimeOut:relativeToAnchorTimeOut:)](coremedia/cmsyncgetrelativerateandanchortime(_:relativeto:relativerateout:anchortimeout:relativetoanchortimeout:).md)
- [CMSyncConvertTime(_:from:to:)](coremedia/cmsyncconverttime(_:from:to:).md)
