<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOTimerDispatchSource",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOTimerDispatchSource"
  },
  "title" : "IOTimerDispatchSource"
}
-->

# IOTimerDispatchSource

A dispatch source that notifies your driver at a specific time.

```
class IOTimerDispatchSource;
```

## Overview

An [`IOTimerDispatchSource`](/documentation/DriverKit/IOTimerDispatchSource) object executes an associated action at a designated time. After configuring the dispatch source object, call the [`WakeAtTime`](/documentation/DriverKit/IOTimerDispatchSource/WakeAtTime) method to schedule the time at which to execute your code. There are several timebases you can use to configure the timer, but the most common one is [`kIOTimerClockMachAbsoluteTime`](/documentation/DriverKit/kIOTimerClockMachAbsoluteTime).

## Topics

### Configuring the Timer Source

[`static kern_return_t Create(IODispatchQueue *queue, IOTimerDispatchSource **source);`](/documentation/DriverKit/IOTimerDispatchSource/Create)

Creates and configures a timer dispatch object.

[`virtual bool init();`](/documentation/DriverKit/IOTimerDispatchSource/init)

Handles the basic initialization of the dispatch source.

[`virtual void free();`](/documentation/DriverKit/IOTimerDispatchSource/free)

Performs any final cleanup for the timer dispatch source.

[`virtual kern_return_t SetHandler(OSAction *action);`](/documentation/DriverKit/IOTimerDispatchSource/SetHandler)

Sets the handler block to run when the timer fires.

### Rescheduling the Timer

[`virtual kern_return_t WakeAtTime(uint64_t options, uint64_t deadline, uint64_t leeway);`](/documentation/DriverKit/IOTimerDispatchSource/WakeAtTime)

Schedules a callback from the timer.

[Clock Types](/documentation/DriverKit/3242783-clock_types)

Clock types to use when configuring a timer.

### Starting and Stopping the Timer Source

[`virtual kern_return_t SetEnableWithCompletion(bool enable, IODispatchSourceCancelHandler handler);`](/documentation/DriverKit/IOTimerDispatchSource/SetEnableWithCompletion)

Enables or disables the timer.

[`virtual kern_return_t Cancel(IODispatchSourceCancelHandler handler);`](/documentation/DriverKit/IOTimerDispatchSource/Cancel)

Cancels all callbacks from the event source.

### Declaring Actions

[`virtual void TimerOccurred(OSAction *action, uint64_t time);`](/documentation/DriverKit/IOTimerDispatchSource/TimerOccurred)

Executes custom code when the timer fires.

[`virtual kern_return_t CheckForWork(bool synchronous);`](/documentation/DriverKit/IOTimerDispatchSource/CheckForWork)

Checks for events to handle.

## Relationships

### Inherits From

[`IODispatchSource`](/documentation/DriverKit/IODispatchSource)

---

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)