<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publisher/measureInterval(using:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE15measureInterval5using7optionsAA10PublishersO07MeasureD0Vy_xqd__Gqd___16SchedulerOptionsQyd__SgtAA0I0Rd__lF"
  },
  "title" : "measureInterval(using:options:)"
}
-->

# measureInterval(using:options:)

Measures and emits the time interval between events received from an upstream publisher.

```
func measureInterval<S>(using scheduler: S, options: S.SchedulerOptions? = nil) -> Publishers.MeasureInterval<Self, S> where S : Scheduler
```

## Parameters

`scheduler`

A scheduler to use for tracking the timing of events.

`options`

Options that customize the delivery of elements.

## Return Value

A publisher that emits elements representing the time interval between the elements it receives.

## Discussion

Use [`measureInterval(using:options:)`](/documentation/Combine/Publisher/measureInterval(using:options:)) to measure the time between events delivered from an upstream publisher.

In the example below, a 1-second <doc://com.apple.documentation/documentation/Foundation/Timer> is used as the data source for an event publisher; the [`measureInterval(using:options:)`](/documentation/Combine/Publisher/measureInterval(using:options:)) operator reports the elapsed time between the reception of events on the main run loop:

```
cancellable = Timer.publish(every: 1, on: .main, in: .default)
    .autoconnect()
    .measureInterval(using: RunLoop.main)
    .sink { print("\($0)", terminator: "\n") }

// Prints:
//      Stride(magnitude: 1.0013610124588013)
//      Stride(magnitude: 0.9992760419845581)
```

The output type of the returned publisher is the time interval of the provided scheduler.

This operator uses the provided scheduler’s [`now`](/documentation/Combine/Scheduler/now) property to measure intervals between events.

---

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)