# SignedDuration

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

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

```rust
struct SignedDuration
```

A signed time interval with a resolution of 100 nanoseconds.

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

## Members

- [`TICKS_PER_MILLISECOND`](#assoc_const-ticks_per_millisecond)
- [`TICKS_PER_SECOND`](#assoc_const-ticks_per_second)
- [`TICKS_PER_MINUTE`](#assoc_const-ticks_per_minute)
- [`TICKS_PER_HOUR`](#assoc_const-ticks_per_hour)
- [`TICKS_PER_DAY`](#assoc_const-ticks_per_day)
- [`ZERO`](#assoc_const-zero)
- [`MAX_VALUE`](#assoc_const-max_value)
- [`MIN_VALUE`](#assoc_const-min_value)
- [`from_ticks`](#function-from_ticks)
- [`from_seconds`](#function-from_seconds)
- [`from_milliseconds`](#function-from_milliseconds)
- [`from_minutes`](#function-from_minutes)
- [`ticks`](#function-ticks)
- [`total_seconds`](#function-total_seconds)
- [`total_milliseconds`](#function-total_milliseconds)
- [`to_duration`](#function-to_duration)
- [`parse`](#function-parse)
- [`from_hms`](#function-from_hms)
- [`from_dhms`](#function-from_dhms)
- [`from_dhms_milliseconds`](#function-from_dhms_milliseconds)
- [`from_hours`](#function-from_hours)
- [`from_days`](#function-from_days)
- [`days`](#function-days)
- [`hours`](#function-hours)
- [`minutes`](#function-minutes)
- [`seconds`](#function-seconds)
- [`milliseconds`](#function-milliseconds)
- [`total_days`](#function-total_days)
- [`total_hours`](#function-total_hours)
- [`total_minutes`](#function-total_minutes)
- [`duration`](#function-duration)
- [`to_string_format`](#function-to_string_format)
- [`try_to_string_format`](#function-try_to_string_format)

<a id="assoc_const-ticks_per_millisecond"></a>

### TICKS_PER_MILLISECOND

```rust
const TICKS_PER_MILLISECOND: i64
```

The number of ticks in one millisecond.

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

<a id="assoc_const-ticks_per_second"></a>

### TICKS_PER_SECOND

```rust
const TICKS_PER_SECOND: i64
```

The number of ticks in one second.

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

<a id="assoc_const-ticks_per_minute"></a>

### TICKS_PER_MINUTE

```rust
const TICKS_PER_MINUTE: i64
```

The number of ticks in one minute.

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

<a id="assoc_const-ticks_per_hour"></a>

### TICKS_PER_HOUR

```rust
const TICKS_PER_HOUR: i64
```

The number of ticks in one hour.

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

<a id="assoc_const-ticks_per_day"></a>

### TICKS_PER_DAY

```rust
const TICKS_PER_DAY: i64
```

The number of ticks in one day.

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

<a id="assoc_const-zero"></a>

### ZERO

```rust
const ZERO: SignedDuration
```

The zero interval.

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

<a id="assoc_const-max_value"></a>

### MAX_VALUE

```rust
const MAX_VALUE: SignedDuration
```

The largest interval.

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

<a id="assoc_const-min_value"></a>

### MIN_VALUE

```rust
const MIN_VALUE: SignedDuration
```

The smallest (most negative) interval.

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

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

### from_ticks

```rust
const fn from_ticks(ticks: i64) -> Self
```

Creates an interval from a number of 100-nanosecond ticks.

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

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

### from_seconds

```rust
fn from_seconds(value: f64) -> Self
```

Creates an interval from a number of seconds, rounded to the nearest
tick. Panics if the value is not a number or out of range.

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

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

### from_milliseconds

```rust
fn from_milliseconds(value: f64) -> Self
```

Creates an interval from a number of milliseconds, rounded to the
nearest tick. Panics if the value is not a number or out of range.

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

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

### from_minutes

```rust
fn from_minutes(value: f64) -> Self
```

Creates an interval from a number of minutes.

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

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

### ticks

```rust
const fn ticks(self: Self) -> i64
```

The number of ticks.

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

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

### total_seconds

```rust
fn total_seconds(self: Self) -> f64
```

The interval in whole and fractional seconds.

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

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

### total_milliseconds

```rust
fn total_milliseconds(self: Self) -> f64
```

The interval in whole and fractional milliseconds.

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

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

### to_duration

```rust
fn to_duration(self: Self) -> Option<Duration>
```

The interval as a `Duration`; `None` when it is negative.

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

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

### parse

```rust
fn parse(s: &str) -> Result<SignedDuration, FormatError>
```

Parses an interval in the invariant format
`[-]{ d | [d.]hh:mm[:ss[.fffffff]] | d:hh:mm:ss[.fffffff] }`.

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

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

### from_hms

```rust
fn from_hms(hours: i32, minutes: i32, seconds: i32) -> Self
```

The interval of the given hours, minutes and seconds (the C#
constructor `TimeSpan(int, int, int)`). Panics on overflow.

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

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

### from_dhms

```rust
fn from_dhms(days: i32, hours: i32, minutes: i32, seconds: i32) -> Self
```

The interval of the given days, hours, minutes and seconds (the C#
constructor `TimeSpan(int, int, int, int)`). Panics on overflow.

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

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

### from_dhms_milliseconds

```rust
fn from_dhms_milliseconds(days: i32, hours: i32, minutes: i32, seconds: i32, milliseconds: i32) -> Self
```

The interval of the given days, hours, minutes, seconds and
milliseconds (the C# constructor `TimeSpan(int, int, int, int, int)`).
Panics on overflow.

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

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

### from_hours

```rust
fn from_hours(value: f64) -> Self
```

Creates an interval from a number of hours.

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

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

### from_days

```rust
fn from_days(value: f64) -> Self
```

Creates an interval from a number of days.

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

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

### days

```rust
const fn days(self: Self) -> i32
```

The whole days of the interval (negative for a negative interval).

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

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

### hours

```rust
const fn hours(self: Self) -> i32
```

The hours component, -23..=23.

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

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

### minutes

```rust
const fn minutes(self: Self) -> i32
```

The minutes component, -59..=59.

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

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

### seconds

```rust
const fn seconds(self: Self) -> i32
```

The seconds component, -59..=59.

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

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

### milliseconds

```rust
const fn milliseconds(self: Self) -> i32
```

The milliseconds component, -999..=999.

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

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

### total_days

```rust
fn total_days(self: Self) -> f64
```

The interval in whole and fractional days.

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

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

### total_hours

```rust
fn total_hours(self: Self) -> f64
```

The interval in whole and fractional hours.

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

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

### total_minutes

```rust
fn total_minutes(self: Self) -> f64
```

The interval in whole and fractional minutes.

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

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

### duration

```rust
fn duration(self: Self) -> SignedDuration
```

The absolute value of the interval. Panics for `TimeSpan::MIN_VALUE`.

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

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

### to_string_format

```rust
fn to_string_format(self: Self, format: &str) -> String
```

Formats with a standard (`c`, `t`, `T`, `g`, `G`) or custom .NET
`TimeSpan` format string; an empty format is `c`. Panics when the
format string is invalid (.NET throws `FormatException`).

The `g` and `G` formats always use `.` as the decimal separator; .NET
uses the one of the culture.

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

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

### try_to_string_format

```rust
fn try_to_string_format(self: Self, format: &str) -> Result<String, FormatError>
```

Like `to_string_format`, but gives the error
of an invalid format string.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- [`IObservable<SignedDuration>`](/docs/0.5.0/api/ferroui-base/reactive/use-iobservable/)
- `Clone`
- `Copy`
- `Debug`
- `Default`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `PartialOrd`
- `Ord`
- `Hash`
- `From<Duration>`
- `TryFrom<SignedDuration>`
- `FromStr`
- `Display`
- `Add`
- `Sub`
- `AddAssign`
- `SubAssign`
- `Neg`
- `Mul<f64>`
- `Add<SignedDuration>`
- `Sub<SignedDuration>`
- `AddAssign<SignedDuration>`
- `SubAssign<SignedDuration>`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)
- [`ValueTypeRegistration`](/docs/0.5.0/api/ferroui-base/data/core/trait-valuetyperegistration/)

## Availability

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