---
title: duration
framework: classkit
role: symbol
role_heading: Instance Property
path: classkit/clsactivity/duration
---

# duration

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

## Declaration

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

## Discussion

Discussion When you create a new activity to represent a new attempt at a task by calling the createNewActivity() method, the duration initializes to zero. After calling the start() method, it begins counting seconds. When you call the stop() method, the duration counter stops. It resumes counting (without resetting) if you make a new call to the 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.

## See Also

### Starting and stopping an activity

- [start()](classkit/clsactivity/start().md)
- [stop()](classkit/clsactivity/stop().md)
- [isStarted](classkit/clsactivity/isstarted.md)
