# LuaDurationObjectAPI (widget methods): World of Warcraft Forever API

Forever 1.60.1 (70959), Interface 16001, Lua 5.1, from Blizzard's own API documentation. Page: https://wowaddons.gg/forever-api/LuaDurationObjectAPI

## Functions

### Assign

```lua
self:Assign(other)
```

Copies another duration object and assigns it to this one.

Arguments:
- `other`: LuaDurationObject

### Copy

```lua
copy = self:Copy()
```

Returns a copy of this duration object.

Returns:
- `copy`: LuaDurationObject

### EvaluateElapsedDuration

```lua
result = self:EvaluateElapsedDuration(curve, [modifier])
```

Calculates the elapsed duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `curve`: LuaCurveObjectBase
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `result`: LuaCurveEvaluatedResult

### EvaluateElapsedPercent

```lua
result = self:EvaluateElapsedPercent(curve, [modifier])
```

Calculates the elapsed duration as a percentage value and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `curve`: LuaCurveObjectBase
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `result`: LuaCurveEvaluatedResult

### EvaluateRemainingDuration

```lua
result = self:EvaluateRemainingDuration(curve, [modifier])
```

Calculates the remaining duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `curve`: LuaCurveObjectBase
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `result`: LuaCurveEvaluatedResult

### EvaluateRemainingPercent

```lua
result = self:EvaluateRemainingPercent(curve, [modifier])
```

Calculates the remaining duration as a percentage value and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `curve`: LuaCurveObjectBase
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `result`: LuaCurveEvaluatedResult

### EvaluateTotalDuration

```lua
result = self:EvaluateTotalDuration(curve, [modifier])
```

Calculates the total duration in seconds and evaluates it against a supplied curve.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `curve`: LuaCurveObjectBase
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `result`: LuaCurveEvaluatedResult

### FormatElapsedDuration

```lua
formatted = self:FormatElapsedDuration(formatter, [modifier])
```

Formats the elapsed duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `formatter`: NumericFormatter
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `formatted`: string

### FormatRemainingDuration

```lua
formatted = self:FormatRemainingDuration(formatter, [modifier])
```

Formats the remaining duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `formatter`: NumericFormatter
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `formatted`: string

### FormatTotalDuration

```lua
formatted = self:FormatTotalDuration(formatter, [modifier])
```

Formats the total duration of this object to a string.

Its returns can be secret values (in some instances and fights): guard them before any arithmetic.

Arguments:
- `formatter`: NumericFormatter
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `formatted`: string

### GetClock

```lua
clock = self:GetClock()
```

Returns the clock source used by this object.

Returns:
- `clock`: LuaDurationClock, may be nil. If nil, the duration object is using an internal default clock source equivalent to GetTime().

### GetClockTime

```lua
clockTime = self:GetClockTime()
```

Returns the current time of the clock source used by this object.

Returns:
- `clockTime`: FrameTime

### GetElapsedDuration

```lua
elapsedDuration = self:GetElapsedDuration([modifier])
```

Calculates the elapsed duration of the stored time span.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `elapsedDuration`: Seconds

### GetElapsedPercent

```lua
elapsedPercent = self:GetElapsedPercent([modifier])
```

Calculates the elapsed duration as a percentage value.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `elapsedPercent`: number

### GetEndTime

```lua
endTime = self:GetEndTime([modifier])
```

Calculates the end time of the stored time span.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `endTime`: FrameTime

### GetModRate

```lua
modRate = self:GetModRate()
```

Returns the divisor used to convert a duration from real time to base time.

Returns:
- `modRate`: number

### GetRemainingDuration

```lua
remainingDuration = self:GetRemainingDuration([modifier])
```

Calculates the remaining duration of the stored time span.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `remainingDuration`: Seconds

### GetRemainingPercent

```lua
remainingPercent = self:GetRemainingPercent([modifier])
```

Calculates the remaining duration as a percentage value.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `remainingPercent`: number

### GetStartTime

```lua
startTime = self:GetStartTime([modifier])
```

Calculates the start time of the stored time span.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `startTime`: FrameTime

### GetTotalDuration

```lua
totalDuration = self:GetTotalDuration([modifier])
```

Calculates the total duration of the stored time span.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `totalDuration`: Seconds

### HasExpired

```lua
hasExpired = self:HasExpired([modifier])
```

Returns true once the duration has reached its end time.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `hasExpired`: bool

### HasSecretValues

```lua
hasSecretValues = self:HasSecretValues()
```

Returns true if the duration has been configured with any secret values.

Returns:
- `hasSecretValues`: bool

### HasStarted

```lua
hasStarted = self:HasStarted([modifier])
```

Returns true once the duration has reached its start time.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `hasStarted`: bool

### IsActive

```lua
isActive = self:IsActive([modifier])
```

Returns true while the duration is at or after its start time and before its end time.

Arguments:
- `modifier`: DurationTimeModifier, default "RealTime"

Returns:
- `isActive`: bool

### IsZero

```lua
isZero = self:IsZero()
```

Returns true if the duration object is measuring a zero duration time span.

Returns:
- `isZero`: bool

### Reset

```lua
self:Reset()
```

Resets the duration object to represent a zero duration time span.

### SetClock

```lua
self:SetClock([clock])
```

Configures the clock source used by this object.

Arguments:
- `clock`: LuaDurationClock, may be nil. If nil, the duration object will use an internal default clock source equivalent to GetTime().

### SetTimeFromEnd

```lua
self:SetTimeFromEnd(endTime, duration, [modRate])
```

Configures the duration object to represent an end time and a duration.

Arguments:
- `endTime`: FrameTime
- `duration`: Seconds
- `modRate`: number, default 1. Optional divisor for converting this time span to a base time.

### SetTimeFromStart

```lua
self:SetTimeFromStart(startTime, duration, [modRate])
```

Configures the duration object to represent a start time and a duration.

Arguments:
- `startTime`: FrameTime
- `duration`: Seconds
- `modRate`: number, default 1. Optional divisor for converting this time span to a base time.

### SetTimeSpan

```lua
self:SetTimeSpan(startTime, endTime)
```

Configures the duration object to represent a fixed start and end time span. If the end time is earlier than the start time, the duration will clamp to zero.

Arguments:
- `startTime`: FrameTime
- `endTime`: FrameTime

### SetToDefaults

```lua
self:SetToDefaults()
```

Resets all state on the duration, and clears the secret values flag.

---
Make an addon with your AI: tell it "Read https://wowaddons.gg/agents.md, then make me a World of Warcraft Forever addon that …, try it with me in the game, and publish it."
