Struct Timestamp
Represents timestamp.
Namespace: DotNext.Diagnostics
Assembly: DotNext.dll
Syntax
public struct Timestamp : IEquatable<Timestamp>, IComparable<Timestamp>
Remarks
This class can be used as allocation-free alternative to
Properties
| Improve this Doc View SourceCurrent
Gets current point in time.
Declaration
public static Timestamp Current { get; }
Property Value
| Type | Description |
|---|---|
| Timestamp |
Elapsed
Gets precise difference between the current point in time and this timestamp.
Declaration
public TimeSpan Elapsed { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Value
Gets
Declaration
public TimeSpan Value { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
| Improve this Doc View SourceCompareTo(Timestamp)
Compares this timestamp with the given value.
Declaration
public int CompareTo(Timestamp other)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | other | The timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Int32 | The result of comparison. |
Equals(Timestamp)
Determines whether the current timestamp equals to the specified timestamp.
Declaration
public bool Equals(Timestamp other)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | other | The timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if this timestamp is equal to |
Equals(Object)
Determines whether the current timestamp equals to the specified timestamp.
Declaration
public override bool Equals(object other)
Parameters
| Type | Name | Description |
|---|---|---|
| Object | other | The timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if this timestamp is equal to |
GetHashCode()
Computes hash code for this timestamp.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| Int32 | The hash code of this timestamp. |
ToString()
Gets timestamp in the form of the string.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | The string representing this timestamp. |
Operators
| Improve this Doc View SourceEquality(Timestamp, Timestamp)
Determines whether the two timestamps are equal.
Declaration
public static bool operator ==(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if both timestamps are equal; otherwise, false. |
GreaterThan(Timestamp, Timestamp)
Determines whether the first timestamp is greater than the second.
Declaration
public static bool operator>(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
GreaterThanOrEqual(Timestamp, Timestamp)
Determines whether the first timestamp is greater than or equal to the second.
Declaration
public static bool operator >=(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
Implicit(Timestamp to TimeSpan)
Gets
Declaration
public static implicit operator TimeSpan(Timestamp stamp)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | stamp | The timestamp to convert. |
Returns
| Type | Description |
|---|---|
| TimeSpan |
Inequality(Timestamp, Timestamp)
Determines whether the two timestamps are equal.
Declaration
public static bool operator !=(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | false if both timestamps are equal; otherwise, true. |
LessThan(Timestamp, Timestamp)
Determines whether the first timestamp is less than the second.
Declaration
public static bool operator <(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |
LessThanOrEqual(Timestamp, Timestamp)
Determines whether the first timestamp is less than or equal to the second.
Declaration
public static bool operator <=(Timestamp first, Timestamp second)
Parameters
| Type | Name | Description |
|---|---|---|
| Timestamp | first | The first timestamp to compare. |
| Timestamp | second | The second timestamp to compare. |
Returns
| Type | Description |
|---|---|
| Boolean | true if |