> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor.client/ks.reactor.client.kstimerestrainer.md).

# Class ksTimeRestrainer

Namespace: [KS.Reactor.Client](/reactor/api-reference/ks.reactor.client.md)\
Assembly: KSUnity.dll

Simple time adjuster that slows down and eventually stops incrementing time after long periods with no updates from the server.

```csharp
public class ksTimeRestrainer : ksITimeAdjuster
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← [ksTimeRestrainer](/reactor/api-reference/ks.reactor.client/ks.reactor.client.kstimerestrainer.md)

#### Implements

[ksITimeAdjuster](/reactor/api-reference/ks.reactor.client/ks.reactor.client.ksitimeadjuster.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksTimeRestrainer(float, float) <a href="#ks_reactor_client_kstimerestrainer__ctor_system_single_system_single" id="ks_reactor_client_kstimerestrainer__ctor_system_single_system_single"></a>

Constructor

```csharp
public ksTimeRestrainer(float slowTime, float maxTime)
```

#### Parameters

`slowTime` [float](https://learn.microsoft.com/dotnet/api/system.single)

Time in seconds after which extrapolation rate slows down if no server updates are received.

`maxTime` [float](https://learn.microsoft.com/dotnet/api/system.single)

Time in seconds after which extrapolation stops if no server updates are received.

### ksTimeRestrainer() <a href="#ks_reactor_client_kstimerestrainer__ctor" id="ks_reactor_client_kstimerestrainer__ctor"></a>

Constructor

```csharp
public ksTimeRestrainer()
```

## Properties

### ExtrapolationTime <a href="#ks_reactor_client_kstimerestrainer_extrapolationtime" id="ks_reactor_client_kstimerestrainer_extrapolationtime"></a>

How long we've been extrapolating without a server update in seconds.

```csharp
public float ExtrapolationTime { get; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### MaxTime <a href="#ks_reactor_client_kstimerestrainer_maxtime" id="ks_reactor_client_kstimerestrainer_maxtime"></a>

Real time in seconds after which extrapolation stops if no server updates are received.

```csharp
public float MaxTime { get; set; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

### SlowTime <a href="#ks_reactor_client_kstimerestrainer_slowtime" id="ks_reactor_client_kstimerestrainer_slowtime"></a>

Real time in seconds after which extrapolation rate slows down if no server updates are received.

```csharp
public float SlowTime { get; set; }
```

#### Property Value

[float](https://learn.microsoft.com/dotnet/api/system.single)

## Methods

### Initialize() <a href="#ks_reactor_client_kstimerestrainer_initialize" id="ks_reactor_client_kstimerestrainer_initialize"></a>

Clears the extrapolation time.

```csharp
public void Initialize()
```

### OnClientUpdate(float) <a href="#ks_reactor_client_kstimerestrainer_onclientupdate_system_single" id="ks_reactor_client_kstimerestrainer_onclientupdate_system_single"></a>

Called once per frame to adjust `deltaTime` to stay in sync with the server.

```csharp
public float OnClientUpdate(float deltaTime)
```

#### Parameters

`deltaTime` [float](https://learn.microsoft.com/dotnet/api/system.single)

Unscaled time delta in seconds of simulation time since the last frame.

#### Returns

[float](https://learn.microsoft.com/dotnet/api/system.single)

adjusted delta time in seconds.

### OnServerUpdate(float, ulong) <a href="#ks_reactor_client_kstimerestrainer_onserverupdate_system_single_system_uint64" id="ks_reactor_client_kstimerestrainer_onserverupdate_system_single_system_uint64"></a>

Called once per server update.

```csharp
public void OnServerUpdate(float unscaledDeltaTime, ulong frameNum)
```

#### Parameters

`unscaledDeltaTime` [float](https://learn.microsoft.com/dotnet/api/system.single)

Time delta in seconds of server simulation time (unscaled) since the last update.

`frameNum` [ulong](https://learn.microsoft.com/dotnet/api/system.uint64)

Frame number from the server.
