Click or drag to resize

Duration Structure

Represents a span of time. This is different from the .NET TimeSpan class in that it offers the same precision as the JulianDate type. It stores a number of days as an Int32 and a number of seconds as a Double.

Namespace:  AGI.Foundation.Time
Assembly:  AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax
public struct Duration : IComparable<Duration>, 
	IComparable, IEquatable<Duration>, IEquatableEpsilon<Duration>

The Duration type exposes the following members.

Constructors
  NameDescription
Public methodDuration(TimeSpan)
Initializes a new Duration from a TimeSpan. The time standard is not specified, so this Duration will match the time standard of anything it is added to or subtracted from.
Public methodDuration(Int32, Double)
Initializes a new instance of Duration from a specified number of days and seconds. The time standard is not specified, so this Duration will match the time standard of anything it is added to or subtracted from.
Public methodDuration(TimeSpan, TimeStandard)
Initializes a new Duration from a TimeSpan. It also specifies that the time is measured using the specified time standard.
Public methodDuration(Int32, Double, TimeStandard)
Initializes a new instance of Duration from a specified number of days and seconds. It also specifies that the time is measured using the specified time standard.
Public methodDuration(Int32, Int32, Int32, Double)
Initializes a new instance of Duration from a specified number of days, hours, minutes, and seconds. The time standard is not specified, so this Duration will match the time standard of anything it is added to or subtracted from.
Public methodDuration(Int32, Int32, Int32, Double, TimeStandard)
Initializes a new instance of Duration from a specified number of days, hours, minutes, and seconds. It also specifies that the time is measured using the specified time standard.
Top
Properties
  NameDescription
Public propertyDays
Gets the day component of this Duration.
Public propertyStatic memberMaxValue
Gets the largest possible value of a Duration.
Public propertyStatic memberMinValue
Gets the smallest possible value of a Duration.
Public propertySeconds
Gets the seconds component of this Duration. This is the number of seconds represented by this Duration in addition to the Days, so it will always be less than SecondsPerDay.
Public propertyStandard
Gets the time standard in which this Duration is measured.
Public propertyTotalDays
Gets the total number of whole and fractional days represented by this Duration.
Public propertyTotalSeconds
Gets the total number of seconds represented by this Duration, including the seconds that compose the days returned by the Days property.
Public propertyStatic memberZero
Gets a Duration of 0 days and seconds.
Top
Methods
  NameDescription
Public methodAdd
Adds the specified Duration to this instance.
Public methodAddDays
Adds a specified number of days to this Duration and returns the new Duration.
Public methodAddSeconds
Adds a specified number of seconds to this Duration and returns the new Duration.
Public methodCompareTo(Duration)
Compares this instance with another instance of the same type.
Public methodCompareTo(Object)
Compares this instance with another instance of the same type.
Public methodDivide(Double)
Divides the Duration by a constant.
Public methodDivide(Duration)
Divides the Duration by another Duration, yield a constant.
Public methodEquals(Duration)
Returns if this Duration exactly equals another Duration, within the limits of floating point precision. To be considered equal, the Days and Standard properties must be identical (or one must be null) and the difference between the Seconds properties must be less than 1.0e-10.
Public methodEquals(Object)
Returns if this Duration exactly equals another Duration, within the limits of floating point precision. To be considered equal, the Days and Standard properties must be identical (or one must be null) and the difference between the Seconds properties must be less than 1.0e-10.
(Overrides ValueTypeEquals(Object).)
Public methodEqualsEpsilon
Returns if this Duration is within epsilon seconds of the specified Duration. That is, in order for the Durations to be considered equal (and for this function to return ), the absolute value of the difference between them, in seconds, must be less than or equal to epsilon.
Public methodStatic memberFromDays(Double)
Returns a Duration that represents the specified number of days.
Public methodStatic memberFromDays(Double, TimeStandard)
Returns a Duration that represents the specified number of days using the specified time standard.
Public methodStatic memberFromHours(Double)
Returns a Duration that represents the specified number of hours.
Public methodStatic memberFromHours(Double, TimeStandard)
Returns a Duration that represents the specified number of hours using the specified time standard.
Public methodStatic memberFromMinutes(Double)
Returns a Duration that represents the specified number of minutes.
Public methodStatic memberFromMinutes(Double, TimeStandard)
Returns a Duration that represents the specified number of minutes using the specified time standard.
Public methodStatic memberFromSeconds(Double)
Returns a Duration that represents the specified number of seconds.
Public methodStatic memberFromSeconds(Double, TimeStandard)
Returns a Duration that represents the specified number of seconds using the specified time standard.
Public methodGetHashCode
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
(Overrides ValueTypeGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberHoursMinutesSecondsToSeconds
Converts the specified number of hours, minutes, and seconds to total duration in seconds.
Public methodMultiply
Multiplies the Duration by a constant.
Public methodSubtract
Subtracts the specified Duration from this instance.
Public methodToString
Returns the value of the Duration in Days:Seconds.
(Overrides ValueTypeToString.)
Public methodToTimeSpan
Returns a TimeSpan equivalent to this Duration.
Top
Operators
  NameDescription
Public operatorStatic memberAddition
Adds two specified Duration instances.
Public operatorStatic memberDivision(Duration, Duration)
Divides the Duration by another duration.
Public operatorStatic memberDivision(Duration, Double)
Divides the Duration by a constant.
Public operatorStatic memberEquality
Returns if two Durations are exactly equal, within the limits of floating point precision. To be considered equal, the Days and Standard properties must be identical (or one must be null) and the difference between the Seconds properties must be less than 1.0e-10.
Public operatorStatic memberGreaterThan
Returns if left is longer than right.
Public operatorStatic memberGreaterThanOrEqual
Returns if left is longer than or exactly equal to right.
Public operatorStatic memberInequality
Returns if two Durations are NOT exactly equal, within the limits of floating point precision. To be considered equal, the Days and Standard properties must be identical (or one must be null) and the difference between the Seconds properties must be less than 1.0e-10.
Public operatorStatic memberLessThan
Returns if left is shorter than right.
Public operatorStatic memberLessThanOrEqual
Returns if left is shorter than or exactly equal to right.
Public operatorStatic memberMultiply
Multiplies the Duration by a constant.
Public operatorStatic memberSubtraction
Subtracts a specified Duration from another specified Duration.
Public operatorStatic memberUnaryNegation
Inverts a specified Duration. For example, if the value represents a positive quantity of time, the returned Duration will be a negative quantity of time.
Top
See Also