Struct HostTimestamp
Stores a local timestamp of an event.
Implements
IComparable
IFormattable
Assembly: cs.temp.dll.dll
Syntax
public struct HostTimestamp : IComparable, IComparable<HostTimestamp>, IEquatable<HostTimestamp>, IFormattable
Fields
MaxValue
Biggest possible timestamp.
Declaration
public static readonly HostTimestamp MaxValue
Field Value
MinValue
Smallest possible timestamp.
Declaration
public static readonly HostTimestamp MinValue
Field Value
Start
Timestamp at the time the system started.
Declaration
public static readonly HostTimestamp Start
Field Value
Properties
Elapsed
Get elapsed time since the creation of this timestamp.
Declaration
public HostTimespan Elapsed { get; }
Property Value
Now
Create a new timestamp at the current time.
Declaration
public static HostTimestamp Now { get; }
Property Value
Methods
CompareTo(HostTimestamp)
Declaration
public int CompareTo(HostTimestamp other)
Parameters
Returns
| Type |
Description |
| System.Int32 |
|
CompareTo(Object)
Declaration
public int CompareTo(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Int32 |
|
Equals(HostTimestamp)
Declaration
public bool Equals(HostTimestamp other)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
FromDateTimeOffset(DateTimeOffset)
Create a timestamp from the DateTimeOffset object.
Declaration
public static HostTimestamp FromDateTimeOffset(DateTimeOffset time)
Parameters
| Type |
Name |
Description |
| DateTimeOffset |
time |
The DateTimeOffset object.
|
Returns
FromStopwatchTicks(Int64)
Create a timestamp with the provided ticks at stopwatch frequency.
Declaration
public static HostTimestamp FromStopwatchTicks(long ticks)
Parameters
| Type |
Name |
Description |
| System.Int64 |
ticks |
Raw ticks.
|
Returns
FromTicks(Int64, Int64)
Create a timestamp from raw ticks with provided frequency.
Declaration
public static HostTimestamp FromTicks(long ticks, long frequency)
Parameters
| Type |
Name |
Description |
| System.Int64 |
ticks |
Raw ticks.
|
| System.Int64 |
frequency |
Ticks per second.
|
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
GetStopwatchTicks()
Get raw ticks with stopwatch frequency.
Declaration
public long GetStopwatchTicks()
Returns
| Type |
Description |
| System.Int64 |
Raw stopwatch ticks.
|
GetTicks(Int64)
Get raw ticks with provided frequency.
Declaration
public long GetTicks(long frequency)
Parameters
| Type |
Name |
Description |
| System.Int64 |
frequency |
Ticks per second.
|
Returns
| Type |
Description |
| System.Int64 |
Raw ticks.
|
ToDateTimeOffset(TimeSpan)
Convert timestamp to a DateTimeOffset object.
Declaration
public DateTimeOffset ToDateTimeOffset(TimeSpan offset)
Parameters
| Type |
Name |
Description |
| TimeSpan |
offset |
UTC offset to use.
|
Returns
| Type |
Description |
| DateTimeOffset |
The DateTimeOffset equivalent.
|
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.ValueType.ToString()
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
| Type |
Name |
Description |
| System.String |
format |
|
| IFormatProvider |
formatProvider |
|
Returns
| Type |
Description |
| System.String |
|
Operators
Addition(HostTimespan, HostTimestamp)
Declaration
public static HostTimestamp operator +(HostTimespan lhs, HostTimestamp rhs)
Parameters
Returns
Addition(HostTimestamp, HostTimespan)
Declaration
public static HostTimestamp operator +(HostTimestamp lhs, HostTimespan rhs)
Parameters
Returns
Equality(HostTimestamp, HostTimestamp)
Declaration
public static bool operator ==(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
GreaterThan(HostTimestamp, HostTimestamp)
Declaration
public static bool operator>(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
GreaterThanOrEqual(HostTimestamp, HostTimestamp)
Declaration
public static bool operator >=(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Inequality(HostTimestamp, HostTimestamp)
Declaration
public static bool operator !=(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
LessThan(HostTimestamp, HostTimestamp)
Declaration
public static bool operator <(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
LessThanOrEqual(HostTimestamp, HostTimestamp)
Declaration
public static bool operator <=(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Subtraction(HostTimestamp, HostTimespan)
Declaration
public static HostTimestamp operator -(HostTimestamp lhs, HostTimespan rhs)
Parameters
Returns
Subtraction(HostTimestamp, HostTimestamp)
Declaration
public static HostTimespan operator -(HostTimestamp lhs, HostTimestamp rhs)
Parameters
Returns
Implements
IComparable
IComparable<>
IEquatable<>
IFormattable