DiscreteTime
Data-type representing a discrete time value.
Read time 2 minutesLast updated 10 days ago
Definition
- Type: Struct
- Namespace: Unity.IntegerTime
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<DiscreteTime>, IFormattable, IComparable<DiscreteTime>
public struct DiscreteTime : IEquatable<DiscreteTime>, IFormattable, IComparable<DiscreteTime>
Fields
Value | Description |
|---|---|
| Value | The underlying discrete time value, which represents the number of discrete ticks. |
Static Fields
Value | Description |
|---|---|
| MaxValue | The maximum representable time. |
| MaxValueSeconds | The maximum representable time in seconds. |
| MinValue | The minimum representable time. |
| MinValueSeconds | The minimum representable time in seconds. |
| Tick | The duration in seconds of a tick (the smallest representable unit of time). |
| Zero | The zero value. |
Constructors
Constructor | Description |
|---|---|
| DiscreteTime(System.Double) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| DiscreteTime(System.Int32) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| DiscreteTime(System.Int64) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| DiscreteTime(System.Single) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
| DiscreteTime(Unity.IntegerTime.DiscreteTime) | Constructs a discrete time from either seconds (float/double) or ticks (int/long). |
Methods
Method | Description |
|---|---|
| ToString | Returns a string representation of the time. |
Static Methods
Method | Description |
|---|---|
| FromTicks | Explicitly converts a tick value to a DiscreteTime value. |
Operators
Operator | Description |
|---|---|
| operator + | Returns the addition of two time values. |
| operator / | A time value divided by a floating point amount. |
| operator == | Returns true if the time is equal to a given time, false otherwise. |
| operator > | Returns whether left-hand time value is greater than the right-hand one. |
| operator >= | Returns whether the left-hand time value is greater than or equal to the right-hand one. |
| RationalTime | Converts a DiscreteTime to a RationalTime representation. This conversion is always lossless. |
| operator != | Returns whether two time values are different. |
| operator < | Returns whether the left-hand time value is less than the right-hand one. |
| operator <= | Returns whether the left-hand time value is less than or equal to the right-hand one. |
| operator % | Returns the modulus of two time values. |
| operator * | Returns the multiplication of two time values. |
| operator - | Returns the substraction of two time values. |