# DiscreteTime

> Data-type representing a discrete time value.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.IntegerTime](/engine/6000.3/script-reference/unity/integertime.md)
* **Assembly:** UnityEngine.CoreModule
* **Implements:** [IEquatable\<DiscreteTime>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IFormattable](https://learn.microsoft.com/dotnet/api/system.iformattable), [IComparable\<DiscreteTime>](https://learn.microsoft.com/dotnet/api/system.icomparable-1)

```csharp
public struct DiscreteTime : IEquatable<DiscreteTime>, IFormattable, IComparable<DiscreteTime>
```

## Fields

| Value                                                                            | Description                                                                        |
| -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| [Value](/engine/6000.3/script-reference/unity/integertime/discretetime/value.md) | The underlying discrete time value, which represents the number of discrete ticks. |

## Static Fields

| Value                                                                                                | Description                                                                  |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [MaxValue](/engine/6000.3/script-reference/unity/integertime/discretetime/maxvalue.md)               | The maximum representable time.                                              |
| [MaxValueSeconds](/engine/6000.3/script-reference/unity/integertime/discretetime/maxvalueseconds.md) | The maximum representable time in seconds.                                   |
| [MinValue](/engine/6000.3/script-reference/unity/integertime/discretetime/minvalue.md)               | The minimum representable time.                                              |
| [MinValueSeconds](/engine/6000.3/script-reference/unity/integertime/discretetime/minvalueseconds.md) | The minimum representable time in seconds.                                   |
| [Tick](/engine/6000.3/script-reference/unity/integertime/discretetime/tick.md)                       | The duration in seconds of a tick (the smallest representable unit of time). |
| [Zero](/engine/6000.3/script-reference/unity/integertime/discretetime/zero.md)                       | The zero value.                                                              |

## Constructors

| Constructor                                                                                                                                         | Description                                                                        |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| [DiscreteTime(System.Double)](/engine/6000.3/script-reference/unity/integertime/discretetime/ctor.md#discretetime\(double\))                        | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| [DiscreteTime(System.Int32)](/engine/6000.3/script-reference/unity/integertime/discretetime/ctor.md#discretetime\(int\))                            | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| [DiscreteTime(System.Int64)](/engine/6000.3/script-reference/unity/integertime/discretetime/ctor.md#discretetime\(long\))                           | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| [DiscreteTime(System.Single)](/engine/6000.3/script-reference/unity/integertime/discretetime/ctor.md#discretetime\(float\))                         | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| [DiscreteTime(Unity.IntegerTime.DiscreteTime)](/engine/6000.3/script-reference/unity/integertime/discretetime/ctor.md#discretetime\(discretetime\)) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |

## Methods

| Method                                                                                 | Description                                  |
| -------------------------------------------------------------------------------------- | -------------------------------------------- |
| [ToString](/engine/6000.3/script-reference/unity/integertime/discretetime/tostring.md) | Returns a string representation of the time. |

## Static Methods

| Method                                                                                   | Description                                               |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| [FromTicks](/engine/6000.3/script-reference/unity/integertime/discretetime/fromticks.md) | Explicitly converts a tick value to a DiscreteTime value. |

## Operators

| Operator                                                                                               | Description                                                                                   |
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- |
| [operator +](/engine/6000.3/script-reference/unity/integertime/discretetime/op-addition.md)            | Returns the addition of two time values.                                                      |
| [operator /](/engine/6000.3/script-reference/unity/integertime/discretetime/op-division.md)            | A time value divided by a floating point amount.                                              |
| [operator ==](/engine/6000.3/script-reference/unity/integertime/discretetime/op-equality.md)           | Returns true if the time is equal to a given time, false otherwise.                           |
| [operator >](/engine/6000.3/script-reference/unity/integertime/discretetime/op-greaterthan.md)         | Returns whether left-hand time value is greater than the right-hand one.                      |
| [operator >=](/engine/6000.3/script-reference/unity/integertime/discretetime/op-greaterthanorequal.md) | Returns whether the left-hand time value is greater than or equal to the right-hand one.      |
| [RationalTime](/engine/6000.3/script-reference/unity/integertime/discretetime/op-implicit.md)          | Converts a DiscreteTime to a RationalTime representation. This conversion is always lossless. |
| [operator !=](/engine/6000.3/script-reference/unity/integertime/discretetime/op-inequality.md)         | Returns whether two time values are different.                                                |
| [operator \<](/engine/6000.3/script-reference/unity/integertime/discretetime/op-lessthan.md)           | Returns whether the left-hand time value is less than the right-hand one.                     |
| [operator \<=](/engine/6000.3/script-reference/unity/integertime/discretetime/op-lessthanorequal.md)   | Returns whether the left-hand time value is less than or equal to the right-hand one.         |
| [operator %](/engine/6000.3/script-reference/unity/integertime/discretetime/op-modulus.md)             | Returns the modulus of two time values.                                                       |
| [operator \*](/engine/6000.3/script-reference/unity/integertime/discretetime/op-multiply.md)           | Returns the multiplication of two time values.                                                |
| [operator -](/engine/6000.3/script-reference/unity/integertime/discretetime/op-subtraction.md)         | Returns the substraction of two time values.                                                  |
