<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMTimebaseSetTimerNextFireTime(_:timer:fireTime:flags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMTimebaseSetTimerNextFireTime"
  },
  "title" : "CMTimebaseSetTimerNextFireTime(_:timer:fireTime:flags:)"
}
-->

# CMTimebaseSetTimerNextFireTime(_:timer:fireTime:flags:)

Sets the time on the timebase’s timeline at which the timer should fire next.

```
func CMTimebaseSetTimerNextFireTime(_ timebase: CMTimebase, timer: CFRunLoopTimer, fireTime: CMTime, flags: UInt32) -> OSStatus
```

## Discussion

The timer must be on the list of timers the timebase manages. The timebase continues to update the timer’s “NextFireDate” according to time jumps and effective rate changes. If `fireTime` is not numeric, or if the timebase is not moving, the “NextFireDate” is set to a future date.

Due to the way that `CFRunLoopTimers` are implemented, if a timer passes through a state in which it is due to fire, it may fire even if its rescheduled before the runloop runs again.  Clients should take care to avoid temporarily scheduling timers in the past.  For example, set the timebase’s rate or time before you set the timer’s next fire time, if you are doing both at once. If setting the timebase’s rate or time might put the timer’s fire time in the past, you may need to set the fire time to `kCMTimeInvalid` across the timebase change.

---

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)