Click or drag to resize

Ticks Structure

Represents an instant in time, or time period, as a 64-bit signed integer with a value that is expressed as the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001.
Inheritance Hierarchy
SystemObject
  SystemValueType
    GSFTicks

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.177-beta
Syntax
View Source

The Ticks type exposes the following members.

Constructors
 NameDescription
Public methodTicks(DateTime) Creates a new Ticks.
Public methodTicks(Int64) Creates a new Ticks.
Public methodTicks(TimeSpan) Creates a new Ticks.
Top
Methods
 NameDescription
Public methodStatic memberAlignToMicrosecondDistribution Returns a floor-aligned microsecond distribution timestamp for given timestamp.
Public methodStatic memberAlignToMillisecondDistribution Returns a floor-aligned millisecond distribution timestamp for given timestamp.
Public methodStatic memberAlignToSubsecondDistribution Returns a floor-aligned sub-second distribution timestamp for given timestamp.
Public methodBaselinedTimestamp 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.
Public methodCompareTo(DateTime) Compares this instance to a specified DateTime and returns an indication of their relative values.
Public methodCompareTo(Int64) Compares this instance to a specified Int64 and returns an indication of their relative values.
Public methodCompareTo(Object) Compares this instance to a specified object and returns an indication of their relative values.
Public methodCompareTo(Ticks) Compares this instance to a specified Ticks and returns an indication of their relative values.
Public methodCompareTo(TimeSpan) Compares this instance to a specified TimeSpan and returns an indication of their relative values.
Public methodDistanceBeyondSecond Gets the distance, in 100-nanoseconds intervals, beyond the top of the second in the timestamp represented by the Ticks.
Public methodEquals(DateTime) Returns a value indicating whether this instance is equal to a specified DateTime value.
Public methodEquals(Int64) Returns a value indicating whether this instance is equal to a specified Int64 value.
Public methodEquals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Public methodEquals(Ticks) Returns a value indicating whether this instance is equal to a specified Ticks value.
Public methodEquals(TimeSpan) Returns a value indicating whether this instance is equal to a specified TimeSpan value.
Public methodStatic memberFromMicroseconds Creates a new Ticks from the specified value in microseconds.
Public methodStatic memberFromMilliseconds Creates a new Ticks from the specified value in milliseconds.
Public methodStatic memberFromSeconds Creates a new Ticks from the specified value in seconds.
Public methodGetHashCode Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodGetTypeCode Returns the TypeCode for value type Int64.
Public methodLocalTimeIsValid(Double, Double) Determines if time, represented by Ticks value in local time, is valid by comparing it to the system clock.
Public methodLocalTimeIsValid(Ticks, Ticks) Determines if time, represented by Ticks value in local time, is valid by comparing it to the system clock.
Public methodStatic memberMicrosecondDistribution Gets a sub-second time distribution in microseconds for the specified samplesPerSecond.
Public methodStatic memberMillisecondDistribution Gets a sub-second time distribution in milliseconds for the specified samplesPerSecond.
Public methodStatic memberParse(String) Converts the string representation of a number to its Ticks equivalent.
Public methodStatic memberParse(String, NumberStyles) Converts the string representation of a number in a specified style to its Ticks equivalent.
Public methodStatic memberParse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its Ticks equivalent.
Public methodStatic memberParse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its Ticks equivalent.
Public methodStatic memberRoundToSecondDistribution Returns the nearest distribution timestamp for given timestamp.
Public methodStatic memberRoundToSubsecondDistribution Returns the nearest sub-second distribution timestamp for given timestamp.
Public methodStatic memberSubsecondDistribution Gets a sub-second time distribution in Ticks for the specified samplesPerSecond.
Public methodTimeIsValid(Ticks, Ticks, Ticks) Determines if time, represented by Ticks value, is valid by comparing it to the specified current time.
Public methodTimeIsValid(Ticks, Double, Double) Determines if time, represented by Ticks value, is valid by comparing it to the specified current time.
Public methodToDays Gets the Ticks value in equivalent number of days.
Public methodToElapsedTimeString Converts the Ticks value into a textual representation of years, days, hours, minutes and seconds.
Public methodToElapsedTimeString(Int32, Double) Converts the Ticks value into a textual representation of years, days, hours, minutes and seconds with the specified number of fractional digits.
Public methodToElapsedTimeString(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.
Public methodToHours Gets the Ticks value in equivalent number of hours.
Public methodToMicroseconds Gets the Ticks value in equivalent number of microseconds.
Public methodStatic memberToMicroseconds(Ticks) Converts value, in 100-nanosecond tick intervals, to microseconds.
Public methodToMilliseconds Gets the Ticks value in equivalent number of milliseconds.
Public methodStatic memberToMilliseconds(Ticks) Converts value, in 100-nanosecond tick intervals, to milliseconds.
Public methodToMinutes Gets the Ticks value in equivalent number of minutes.
Public methodStatic memberToSecondDistribution Returns the distribution timestamp for given timestamp or MinValue if there is no TS within the specified Tolerance.
Public methodToSeconds Gets the Ticks value in equivalent number of seconds.
Public methodStatic memberToSeconds(Ticks) Converts value, in 100-nanosecond tick intervals, to seconds.
Public methodToString Converts the value of the Ticks value to its equivalent DateTime string representation.
(Overrides ValueTypeToString)
Public methodToString(IFormatProvider) Converts the Ticks value to its equivalent string representation, using the specified culture-specific DateTime format information.
Public methodToString(String) Converts the Ticks value to its equivalent string representation, using the specified DateTime format.
Public methodToString(String, IFormatProvider) Converts the Ticks value to its equivalent string representation, using specified format and culture-specific DateTime format information.
Public methodStatic memberTryParse(String, Ticks) Converts the string representation of a number to its Ticks equivalent. A return value indicates whether the conversion succeeded or failed.
Public methodStatic memberTryParse(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.
Public methodUtcTimeIsValid(Double, Double) Determines if time, represented by Ticks value in UTC time, is valid by comparing it to the system clock.
Public methodUtcTimeIsValid(Ticks, Ticks) Determines if time, represented by Ticks value in UTC time, is valid by comparing it to the system clock.
Top
Operators
 NameDescription
Public operatorStatic memberAddition(Ticks, Ticks) Returns computed sum of values.
Public operatorStatic memberBitwiseAnd(Ticks, Ticks) Returns logical bitwise AND of values.
Public operatorStatic memberBitwiseOr(Ticks, Ticks) Returns logical bitwise OR of values.
Public operatorStatic memberDivision(Ticks, Ticks) Returns computed division of values.
Public operatorStatic memberEquality(Ticks, Ticks) Compares the two values for equality.
Public operatorStatic memberExclusiveOr(Ticks, Ticks) Returns logical bitwise exclusive-OR of values.
Public operatorStatic memberExponent(Ticks, Ticks) Returns result of first value raised to power of second value.
Public operatorStatic memberFalse(Ticks) Returns true if value is equal to zero.
Public operatorStatic memberGreaterThan(Ticks, Ticks) Returns true if left value is greater than right value.
Public operatorStatic memberGreaterThanOrEqual(Ticks, Ticks) Returns true if left value is greater than or equal to right value.
Public operatorStatic member(DateTime to Ticks) Implicitly converts value, represented as a DateTime, to a Ticks.
Public operatorStatic member(Int64 to Ticks) Implicitly converts value, represented in ticks, to a Ticks.
Public operatorStatic member(Ticks to NtpTimeTag) Implicitly converts Ticks, represented in ticks, to an NtpTimeTag.
Public operatorStatic member(Ticks to UnixTimeTag) Implicitly converts Ticks, represented in ticks, to a UnixTimeTag.
Public operatorStatic member(Ticks to DateTime) Implicitly converts Ticks, represented in ticks, to a DateTime.
Public operatorStatic member(Ticks to Int64) Implicitly converts Ticks, represented in ticks, to an Int64.
Public operatorStatic member(Ticks to TimeSpan) Implicitly converts Ticks, represented in ticks, to a TimeSpan.
Public operatorStatic member(TimeSpan to Ticks) Implicitly converts value, represented as a TimeSpan, to a Ticks.
Public operatorStatic member(TimeTagBase to Ticks) Implicitly converts value, represented as a TimeTagBase, to a Ticks.
Public operatorStatic memberInequality(Ticks, Ticks) Compares the two values for inequality.
Public operatorStatic memberLeftShift(Ticks, Int32) Returns value after left shifts of first value by the number of bits specified by second value.
Public operatorStatic memberLessThan(Ticks, Ticks) Returns true if left value is less than right value.
Public operatorStatic memberLessThanOrEqual(Ticks, Ticks) Returns true if left value is less or equal to than right value.
Public operatorStatic memberModulus(Ticks, Ticks) Returns computed remainder after dividing first value by the second.
Public operatorStatic memberMultiply(Ticks, Ticks) Returns computed product of values.
Public operatorStatic memberOnesComplement(Ticks) Returns bitwise complement of value.
Public operatorStatic memberRightShift(Ticks, Int32) Returns value after right shifts of first value by the number of bits specified by second value.
Public operatorStatic memberSubtraction(Ticks, Ticks) Returns computed difference of values.
Public operatorStatic memberTrue(Ticks) Returns true if value is not zero.
Top
Fields
 NameDescription
Public fieldStatic memberMaxValue Represents the largest possible value of a Ticks. This field is constant.
Public fieldStatic memberMinValue Represents the smallest possible value of a Ticks. This field is constant.
Public fieldStatic memberPerDay Number of 100-nanosecond ticks in one day.
Public fieldStatic memberPerHour Number of 100-nanosecond ticks in one hour.
Public fieldStatic memberPerMicrosecond Number of 100-nanosecond ticks in one microsecond.
Public fieldStatic memberPerMillisecond Number of 100-nanosecond ticks in one millisecond.
Public fieldStatic memberPerMinute Number of 100-nanosecond ticks in one minute.
Public fieldStatic memberPerSecond Number of 100-nanosecond ticks in one second.
Public fieldValue Time value stored in ticks.
Top
Extension Methods
 NameDescription
Public Extension MethodGetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Public Extension MethodGetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
Top
Remarks

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.

See Also

Reference

GSF Namespace