<!--
{
  "availability" : [
    "iOS: 11.3.0 -",
    "iPadOS: 11.3.0 -",
    "macCatalyst: 11.3.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ClassKit",
  "identifier" : "/documentation/ClassKit/CLSActivity/duration",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "ClassKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CLSActivity(py)duration"
  },
  "title" : "duration"
}
-->

# duration

The cumulative time in seconds that an activity has been active.

```
var duration: TimeInterval { get }
```

## Discussion

When you create a new activity to represent a new attempt at a task by calling the [`createNewActivity()`](/documentation/ClassKit/CLSContext/createNewActivity()) method, the duration initializes to zero. After calling the [`start()`](/documentation/ClassKit/CLSActivity/start()) method, it begins counting seconds. When you call the [`stop()`](/documentation/ClassKit/CLSActivity/stop()) method, the duration counter stops. It resumes counting (without resetting) if you make a new call to the [`start()`](/documentation/ClassKit/CLSActivity/start()) method, enabling you to effectively pause an activity. However, when you create a new activity, the duration of the previous activity stops permanently and is no longer accessible to your app.

---

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)