<!--
{
  "availability" : [
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGEventSource/secondsSinceLastEventType(_:eventType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Core Graphics",
      "CoreGraphics"
    ],
    "preciseIdentifier" : "c:@F@CGEventSourceSecondsSinceLastEventType"
  },
  "title" : "secondsSinceLastEventType(_:eventType:)"
}
-->

# secondsSinceLastEventType(_:eventType:)

Returns the elapsed time since the last event for a Quartz event source.

```
class func secondsSinceLastEventType(_ stateID: CGEventSourceStateID, eventType: CGEventType) -> CFTimeInterval
```

## Parameters

`stateID`

The source state to access. Pass one of the constants listed in [`CGEventSourceStateID`](/documentation/CoreGraphics/CGEventSourceStateID).

`eventType`

The event type to access. To get the elapsed time since the previous input event—keyboard, mouse, or tablet—specify `kCGAnyInputEventType`.

## Return Value

The time in seconds since the previous input event of the specified type.

## Discussion

---

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)