---
title: "convertTime(_:from:)"
framework: quartzcore
role: symbol
role_heading: Instance Method
path: "quartzcore/calayer/converttime(_:from:)"
---

# convertTime(_:from:)

Converts the time interval from the specified layer’s time space to the receiver’s time space.

## Declaration

```swift
func convertTime(_ t: CFTimeInterval, from l: CALayer?) -> CFTimeInterval
```

## Parameters

- `t`: A point specifying a location in the coordinate system of l.
- `l`: The layer with t in its time space. The receiver and l and must share a common parent layer.

## Return Value

Return Value The time interval converted to the receiver’s time space.

## Discussion

Discussion The following code shows the creation of two layers, layer and offsetSlowMoLayer. offsetSlowMoLayer has an offset time of 1 second and its speed is set to 0.5.  The last line converts and prints a time interval of 0.5 seconds converted from the time space of layer to the time space of offsetSlowMoLayer. let layer = CALayer() let offsetSlowMoLayer = CALayer()         offsetSlowMoLayer.timeOffset = CFTimeInterval(1) offsetSlowMoLayer.speed = 0.5         print(offsetSlowMoLayer.convertTime(CFTimeInterval(0.5), from: layer)) // prints 1.25

## See Also

### Mapping between coordinate and time spaces

- [convert(_:from:)](quartzcore/calayer/convert(_:from:)-8kl76.md)
- [convert(_:to:)](quartzcore/calayer/convert(_:to:)-7dcke.md)
- [convert(_:from:)](quartzcore/calayer/convert(_:from:)-4kx9l.md)
- [convert(_:to:)](quartzcore/calayer/convert(_:to:)-tly5.md)
- [convertTime(_:to:)](quartzcore/calayer/converttime(_:to:).md)
