<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "QuartzCore",
  "identifier" : "/documentation/QuartzCore/CADisplayLink/targetTimestamp",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Animation"
    ],
    "preciseIdentifier" : "c:objc(cs)CADisplayLink(py)targetTimestamp"
  },
  "title" : "targetTimestamp"
}
-->

# targetTimestamp

The time interval that represents when the next frame displays.

```
var targetTimestamp: CFTimeInterval { get }
```

## Discussion

You can use the target timestamp to cancel or pause long running processes that may overrun the available time between frames in order to maintain a consistent frame rate.

The following code shows how you can create a display link and register it with a run loop. The `step(``displayLink:)` function attempts to sum the square roots of all numbers up to <doc://com.apple.documentation/documentation/Swift/Int/max>, but with each iteration checks the current time ([`CACurrentMediaTime()`](/documentation/QuartzCore/CACurrentMediaTime())) against the [`targetTimestamp`](/documentation/QuartzCore/CADisplayLink/targetTimestamp). If the time taken to complete the calculation is later than the target timestamp, the function breaks the loop:

```swift
func createDisplayLink() {
    let displayLink = CADisplayLink(target: self,
                                    selector: #selector(step))
    displayLink.add(to: .main,
                    forMode: .defaultRunLoopMode)
}
    
func step(displayLink: CADisplayLink) {
    var sqrtSum = 0.0
    for i in 0 ..< Int.max {
        sqrtSum += sqrt(Double(i))
        
        if (CACurrentMediaTime() >= displayLink.targetTimestamp) {
            print("break at i =", i)
            break
        }
    }
}
```

---

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)