<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CALayer/convertTime(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CALayer(im)convertTime:toLayer:"
  },
  "title" : "convertTime(_:to:)"
}
-->

# convertTime(_:to:)

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

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

## Parameters

`t`

A point specifying a location in the coordinate system of `l`.

`l`

The layer into whose time space `t` is to be converted. The receiver and `l` and must share a common parent layer.

## Return Value

The time interval converted to the time space of `layer`.

## Discussion

The following code shows the creation of two layers, `layer` and `offsetSlowMoLayer`. `offsetSlowMoLayer` has an offset time of 1 second and its [`speed`](/documentation/QuartzCore/CAMediaTiming/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`.

```swift
let layer = CALayer()
let offsetSlowMoLayer = CALayer()
     
offsetSlowMoLayer.timeOffset = CFTimeInterval(1)
offsetSlowMoLayer.speed = 0.5
     
print(layer.convertTime(CFTimeInterval(0.5), to: offsetSlowMoLayer)) // prints 1.25
```

---

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)