# ClockBase

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/animation/struct-clockbase/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct ClockBase
```

The shared implementation of clocks that are driven by another time
source: converts the source's time to the time elapsed since this clock's
first pulse, not counting the time spent paused.

The owning clock forwards its source's ticks to `pulse`
and supplies what to do when the clock stops.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L12)

## Members

- [`new`](#function-new)
- [`has_subscriptions`](#function-has_subscriptions)
- [`play_state`](#function-play_state)
- [`set_play_state`](#function-set_play_state)
- [`pulse`](#function-pulse)
- [`subscribe`](#function-subscribe)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L26)

<a id="function-has_subscriptions"></a>

### has_subscriptions

```rust
fn has_subscriptions(self: &Self) -> bool
```

Whether anything is subscribed to the clock.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L36)

<a id="function-play_state"></a>

### play_state

```rust
fn play_state(self: &Self) -> PlayState
```

The playback state of the clock.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L42)

<a id="function-set_play_state"></a>

### set_play_state

```rust
fn set_play_state(self: &Self, value: PlayState)
```

Sets the playback state of the clock.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L48)

<a id="function-pulse"></a>

### pulse

```rust
fn pulse(self: &Self, system_time: SignedDuration, stop: impl FnOnce() -> ())
```

Advances the clock to `system_time` and notifies the subscribers.
`stop` runs afterwards if the clock has been stopped.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L54)

<a id="function-subscribe"></a>

### subscribe

```rust
fn subscribe(self: &Self, observer: Rc<dyn IObserver<SignedDuration>>) -> Rc<dyn IDisposable>
```

Subscribes to the clock's time.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/animation/clock_base.rs#L79)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Default`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
