Ticks Structure |
[SerializableAttribute] public struct Ticks : IComparable, IFormattable, IConvertible, IComparable<Ticks>, IComparable<long>, IComparable<DateTime>, IComparable<TimeSpan>, IEquatable<Ticks>, IEquatable<long>, IEquatable<DateTime>, IEquatable<TimeSpan>
The Ticks type exposes the following members.
Name | Description | |
---|---|---|
Ticks(DateTime) | Creates a new Ticks. | |
Ticks(Int64) | Creates a new Ticks. | |
Ticks(TimeSpan) | Creates a new Ticks. |
Name | Description | |
---|---|---|
AlignToMicrosecondDistribution | Returns a floor-aligned microsecond distribution timestamp for given timestamp. | |
AlignToMillisecondDistribution | Returns a floor-aligned millisecond distribution timestamp for given timestamp. | |
AlignToSubsecondDistribution | Returns a floor-aligned sub-second distribution timestamp for given timestamp. | |
BaselinedTimestamp | Creates a new Ticks value that represents a base-lined timestamp, in 100-nanoseconds intervals, that begins at the beginning of the specified time interval. | |
CompareTo(DateTime) | Compares this instance to a specified DateTime and returns an indication of their relative values. | |
CompareTo(Int64) | Compares this instance to a specified Int64 and returns an indication of their relative values. | |
CompareTo(Object) | Compares this instance to a specified object and returns an indication of their relative values. | |
CompareTo(Ticks) | Compares this instance to a specified Ticks and returns an indication of their relative values. | |
CompareTo(TimeSpan) | Compares this instance to a specified TimeSpan and returns an indication of their relative values. | |
DistanceBeyondSecond | Gets the distance, in 100-nanoseconds intervals, beyond the top of the second in the timestamp represented by the Ticks. | |
Equals(DateTime) | Returns a value indicating whether this instance is equal to a specified DateTime value. | |
Equals(Int64) | Returns a value indicating whether this instance is equal to a specified Int64 value. | |
Equals(Object) |
Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object)) | |
Equals(Ticks) | Returns a value indicating whether this instance is equal to a specified Ticks value. | |
Equals(TimeSpan) | Returns a value indicating whether this instance is equal to a specified TimeSpan value. | |
FromMicroseconds | Creates a new Ticks from the specified value in microseconds. | |
FromMilliseconds | Creates a new Ticks from the specified value in milliseconds. | |
FromSeconds | Creates a new Ticks from the specified value in seconds. | |
GetHashCode |
Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode) | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
GetTypeCode | Returns the TypeCode for value type Int64. | |
LocalTimeIsValid(Double, Double) | Determines if time, represented by Ticks value in local time, is valid by comparing it to the system clock. | |
LocalTimeIsValid(Ticks, Ticks) | Determines if time, represented by Ticks value in local time, is valid by comparing it to the system clock. | |
MicrosecondDistribution | Gets a sub-second time distribution in microseconds for the specified samplesPerSecond. | |
MillisecondDistribution | Gets a sub-second time distribution in milliseconds for the specified samplesPerSecond. | |
Parse(String) | Converts the string representation of a number to its Ticks equivalent. | |
Parse(String, NumberStyles) | Converts the string representation of a number in a specified style to its Ticks equivalent. | |
Parse(String, IFormatProvider) | Converts the string representation of a number in a specified culture-specific format to its Ticks equivalent. | |
Parse(String, NumberStyles, IFormatProvider) | Converts the string representation of a number in a specified style and culture-specific format to its Ticks equivalent. | |
RoundToSecondDistribution | Returns the nearest distribution timestamp for given timestamp. | |
RoundToSubsecondDistribution | Returns the nearest sub-second distribution timestamp for given timestamp. | |
SubsecondDistribution | Gets a sub-second time distribution in Ticks for the specified samplesPerSecond. | |
TimeIsValid(Ticks, Ticks, Ticks) | Determines if time, represented by Ticks value, is valid by comparing it to the specified current time. | |
TimeIsValid(Ticks, Double, Double) | Determines if time, represented by Ticks value, is valid by comparing it to the specified current time. | |
ToDays | Gets the Ticks value in equivalent number of days. | |
ToElapsedTimeString | Converts the Ticks value into a textual representation of years, days, hours, minutes and seconds. | |
ToElapsedTimeString(Int32, Double) | Converts the Ticks value into a textual representation of years, days, hours, minutes and seconds with the specified number of fractional digits. | |
ToElapsedTimeString(Int32, String, Double) | Converts the Ticks value into a textual representation of years, days, hours, minutes and seconds with the specified number of fractional digits given string array of time names. | |
ToHours | Gets the Ticks value in equivalent number of hours. | |
ToMicroseconds | Gets the Ticks value in equivalent number of microseconds. | |
ToMicroseconds(Ticks) | Converts value, in 100-nanosecond tick intervals, to microseconds. | |
ToMilliseconds | Gets the Ticks value in equivalent number of milliseconds. | |
ToMilliseconds(Ticks) | Converts value, in 100-nanosecond tick intervals, to milliseconds. | |
ToMinutes | Gets the Ticks value in equivalent number of minutes. | |
ToSecondDistribution | Returns the distribution timestamp for given timestamp or MinValue if there is no TS within the specified Tolerance. | |
ToSeconds | Gets the Ticks value in equivalent number of seconds. | |
ToSeconds(Ticks) | Converts value, in 100-nanosecond tick intervals, to seconds. | |
ToString |
Converts the value of the Ticks value to its equivalent DateTime string representation.
(Overrides ValueTypeToString) | |
ToString(IFormatProvider) | Converts the Ticks value to its equivalent string representation, using the specified culture-specific DateTime format information. | |
ToString(String) | Converts the Ticks value to its equivalent string representation, using the specified DateTime format. | |
ToString(String, IFormatProvider) | Converts the Ticks value to its equivalent string representation, using specified format and culture-specific DateTime format information. | |
TryParse(String, Ticks) | Converts the string representation of a number to its Ticks equivalent. A return value indicates whether the conversion succeeded or failed. | |
TryParse(String, NumberStyles, IFormatProvider, Ticks) | Converts the string representation of a number in a specified style and culture-specific format to its Ticks equivalent. A return value indicates whether the conversion succeeded or failed. | |
UtcTimeIsValid(Double, Double) | Determines if time, represented by Ticks value in UTC time, is valid by comparing it to the system clock. | |
UtcTimeIsValid(Ticks, Ticks) | Determines if time, represented by Ticks value in UTC time, is valid by comparing it to the system clock. |
Name | Description | |
---|---|---|
Addition(Ticks, Ticks) | Returns computed sum of values. | |
BitwiseAnd(Ticks, Ticks) | Returns logical bitwise AND of values. | |
BitwiseOr(Ticks, Ticks) | Returns logical bitwise OR of values. | |
Division(Ticks, Ticks) | Returns computed division of values. | |
Equality(Ticks, Ticks) | Compares the two values for equality. | |
ExclusiveOr(Ticks, Ticks) | Returns logical bitwise exclusive-OR of values. | |
Exponent(Ticks, Ticks) | Returns result of first value raised to power of second value. | |
False(Ticks) | Returns true if value is equal to zero. | |
GreaterThan(Ticks, Ticks) | Returns true if left value is greater than right value. | |
GreaterThanOrEqual(Ticks, Ticks) | Returns true if left value is greater than or equal to right value. | |
(DateTime to Ticks) | Implicitly converts value, represented as a DateTime, to a Ticks. | |
(Int64 to Ticks) | Implicitly converts value, represented in ticks, to a Ticks. | |
(Ticks to NtpTimeTag) | Implicitly converts Ticks, represented in ticks, to an NtpTimeTag. | |
(Ticks to UnixTimeTag) | Implicitly converts Ticks, represented in ticks, to a UnixTimeTag. | |
(Ticks to DateTime) | Implicitly converts Ticks, represented in ticks, to a DateTime. | |
(Ticks to Int64) | Implicitly converts Ticks, represented in ticks, to an Int64. | |
(Ticks to TimeSpan) | Implicitly converts Ticks, represented in ticks, to a TimeSpan. | |
(TimeSpan to Ticks) | Implicitly converts value, represented as a TimeSpan, to a Ticks. | |
(TimeTagBase to Ticks) | Implicitly converts value, represented as a TimeTagBase, to a Ticks. | |
Inequality(Ticks, Ticks) | Compares the two values for inequality. | |
LeftShift(Ticks, Int32) | Returns value after left shifts of first value by the number of bits specified by second value. | |
LessThan(Ticks, Ticks) | Returns true if left value is less than right value. | |
LessThanOrEqual(Ticks, Ticks) | Returns true if left value is less or equal to than right value. | |
Modulus(Ticks, Ticks) | Returns computed remainder after dividing first value by the second. | |
Multiply(Ticks, Ticks) | Returns computed product of values. | |
OnesComplement(Ticks) | Returns bitwise complement of value. | |
RightShift(Ticks, Int32) | Returns value after right shifts of first value by the number of bits specified by second value. | |
Subtraction(Ticks, Ticks) | Returns computed difference of values. | |
True(Ticks) | Returns true if value is not zero. |
Name | Description | |
---|---|---|
MaxValue | Represents the largest possible value of a Ticks. This field is constant. | |
MinValue | Represents the smallest possible value of a Ticks. This field is constant. | |
PerDay | Number of 100-nanosecond ticks in one day. | |
PerHour | Number of 100-nanosecond ticks in one hour. | |
PerMicrosecond | Number of 100-nanosecond ticks in one microsecond. | |
PerMillisecond | Number of 100-nanosecond ticks in one millisecond. | |
PerMinute | Number of 100-nanosecond ticks in one minute. | |
PerSecond | Number of 100-nanosecond ticks in one second. | |
Value | Time value stored in ticks. |
Name | Description | |
---|---|---|
GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) | |
GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
Ticks can represent an "instant in time" and therefore can be used exactly like a DateTime. The difference between Ticks and DateTime is that Ticks is essentially a long integer (i.e., an Int64) which represents the number of ticks that have elapsed since 12:00:00 midnight, January 1, 0001 with each tick having a resolution of 100-nanoseconds. You would use Ticks in places where you needed to directly represent time in high-resolution, i.e., time with sub-second accuracy, using an object that will act like a long integer but handle time conversions. Ticks can also represent a "time period" (e.g., the number of ticks elapsed since a process started) and thus can also be used like a TimeSpan; when used in this manner the ToElapsedTimeString method can be used to convert the Ticks value into a handy textual representation of elapsed years, days, hours, minutes and seconds or sub-seconds.
This class behaves just like an Int64 representing a time in ticks; it is implicitly castable to and from an Int64 and therefore can be generally used "as" an Int64 directly. It is also implicitly castable to and from a DateTime, a TimeSpan, an NtpTimeTag and a UnixTimeTag.