Table of Contents

Struct TimeValue

Namespace
xFunc.Maths.Expressions.Units.TimeUnits
Assembly
xFunc.Maths.dll

Represents a number with unit.

public readonly struct TimeValue : IEquatable<TimeValue>, IComparable<TimeValue>, IComparable
Implements
Inherited Members

Constructors

TimeValue(NumberValue, TimeUnit)

Initializes a new instance of the TimeValue struct.

public TimeValue(NumberValue value, TimeUnit unit)

Parameters

value NumberValue

The value.

unit TimeUnit

The unit of number.

Properties

Sign

Gets an integer that indicates the sign of a double-precision floating-point number.

public double Sign { get; }

Property Value

double

Unit

Gets a unit.

public TimeUnit Unit { get; }

Property Value

TimeUnit

Value

Gets a value.

public NumberValue Value { get; }

Property Value

NumberValue

Methods

Abs(TimeValue)

Returns the absolute value of a specified value.

public static TimeValue Abs(TimeValue value)

Parameters

value TimeValue

The value.

Returns

TimeValue

The power value, x, that such that 0 ≤ xMaxValue.

AsExpression()

Converts TimeValue to Time.

public Time AsExpression()

Returns

Time

The length number.

Ceiling(TimeValue)

Returns the smallest integral value that is greater than or equal to the specified value.

public static TimeValue Ceiling(TimeValue value)

Parameters

value TimeValue

The value.

Returns

TimeValue

The smallest integral value.

CompareTo(object?)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(object? obj)

Parameters

obj object

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes obj in the sort order.
Zero This instance occurs in the same position in the sort order as obj.
Greater than zero This instance follows obj in the sort order.

Exceptions

ArgumentException

obj is not the same type as this instance.

CompareTo(TimeValue)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(TimeValue other)

Parameters

other TimeValue

An object to compare with this instance.

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

Day(double)

Creates the TimeValue struct with Day unit.

public static TimeValue Day(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Day(NumberValue)

Creates the TimeValue struct with Day unit.

public static TimeValue Day(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Equals(TimeValue)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(TimeValue other)

Parameters

other TimeValue

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Floor(TimeValue)

Returns the largest integral value less than or equal to the specified value number.

public static TimeValue Floor(TimeValue value)

Parameters

value TimeValue

The value.

Returns

TimeValue

The largest integral value.

Frac(TimeValue)

Returns the fractional part of the value number.

public static TimeValue Frac(TimeValue value)

Parameters

value TimeValue

The value number.

Returns

TimeValue

The fractional part.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Hour(double)

Creates the TimeValue struct with Hour unit.

public static TimeValue Hour(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Hour(NumberValue)

Creates the TimeValue struct with Hour unit.

public static TimeValue Hour(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Microsecond(double)

Creates the TimeValue struct with Microsecond unit.

public static TimeValue Microsecond(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Microsecond(NumberValue)

Creates the TimeValue struct with Microsecond unit.

public static TimeValue Microsecond(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Millisecond(double)

Creates the TimeValue struct with Millisecond unit.

public static TimeValue Millisecond(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Millisecond(NumberValue)

Creates the TimeValue struct with Millisecond unit.

public static TimeValue Millisecond(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Minute(double)

Creates the TimeValue struct with Minute unit.

public static TimeValue Minute(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Minute(NumberValue)

Creates the TimeValue struct with Minute unit.

public static TimeValue Minute(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Nanosecond(double)

Creates the TimeValue struct with Nanosecond unit.

public static TimeValue Nanosecond(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Nanosecond(NumberValue)

Creates the TimeValue struct with Nanosecond unit.

public static TimeValue Nanosecond(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Round(TimeValue, NumberValue)

Rounds a double-precision floating-point value to a specified number of fractional digits, and uses the specified rounding convention for midpoint values.

public static TimeValue Round(TimeValue timeValue, NumberValue digits)

Parameters

timeValue TimeValue

The number.

digits NumberValue

The number of fractional digits in the return value.

Returns

TimeValue

The number nearest to timeValue that has a number of fractional digits equal to digits. If value has fewer fractional digits than digits, timeValue is returned unchanged.

Second(double)

Creates the TimeValue struct with Second unit.

public static TimeValue Second(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Second(NumberValue)

Creates the TimeValue struct with Second unit.

public static TimeValue Second(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

To(TimeUnit)

Convert to the newUnit unit.

public TimeValue To(TimeUnit newUnit)

Parameters

newUnit TimeUnit

The new unit.

Returns

TimeValue

The value in the new unit.

ToDay()

Converts the value to the day unit.

public TimeValue ToDay()

Returns

TimeValue

The value in day unit.

ToHour()

Converts the value to the hour unit.

public TimeValue ToHour()

Returns

TimeValue

The value in hour unit.

ToMicrosecond()

Converts the value to the microsecond unit.

public TimeValue ToMicrosecond()

Returns

TimeValue

The value in microsecond unit.

ToMillisecond()

Converts the value to the millisecond unit.

public TimeValue ToMillisecond()

Returns

TimeValue

The value in millisecond unit.

ToMinute()

Converts the value to the minute unit.

public TimeValue ToMinute()

Returns

TimeValue

The value in minute unit.

ToNanosecond()

Converts the value to the nanosecond unit.

public TimeValue ToNanosecond()

Returns

TimeValue

The value in nanosecond unit.

ToSecond()

Converts the value to the second unit.

public TimeValue ToSecond()

Returns

TimeValue

The value in second unit.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToWeek()

Converts the value to the week unit.

public TimeValue ToWeek()

Returns

TimeValue

The value in week unit.

ToYear()

Converts the value to the year unit.

public TimeValue ToYear()

Returns

TimeValue

The value in year unit.

Truncate(TimeValue)

Calculates the integral part of a specified value number.

public static TimeValue Truncate(TimeValue value)

Parameters

value TimeValue

An value to truncate.

Returns

TimeValue

The integral part of value number.

Week(double)

Creates the TimeValue struct with Week unit.

public static TimeValue Week(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Week(NumberValue)

Creates the TimeValue struct with Week unit.

public static TimeValue Week(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Year(double)

Creates the TimeValue struct with Year unit.

public static TimeValue Year(double value)

Parameters

value double

The value.

Returns

TimeValue

The time value.

Year(NumberValue)

Creates the TimeValue struct with Year unit.

public static TimeValue Year(NumberValue value)

Parameters

value NumberValue

The value.

Returns

TimeValue

The time value.

Operators

operator +(TimeValue, TimeValue)

Adds two objects of TimeValue.

public static TimeValue operator +(TimeValue left, TimeValue right)

Parameters

left TimeValue

The first object to add.

right TimeValue

The second object to add.

Returns

TimeValue

An object that is the sum of left and right.

operator ==(TimeValue, TimeValue)

Determines whether two specified instances of TimeValue are equal.

public static bool operator ==(TimeValue left, TimeValue right)

Parameters

left TimeValue

The first object to compare.

right TimeValue

The second object to compare.

Returns

bool

true if left is equal to right; otherwise, false.

operator >(TimeValue, TimeValue)

Indicates whether left parameter is greater than the right parameter.

public static bool operator >(TimeValue left, TimeValue right)

Parameters

left TimeValue

The left value.

right TimeValue

The right value.

Returns

bool

true if the left parameter is greater than the right parameter; otherwise, false.

operator >=(TimeValue, TimeValue)

Indicates whether left parameter is greater than or equal to the right parameter.

public static bool operator >=(TimeValue left, TimeValue right)

Parameters

left TimeValue

The left value.

right TimeValue

The right value.

Returns

bool

true if the left parameter is greater than or equal to the right parameter; otherwise, false.

operator !=(TimeValue, TimeValue)

Determines whether two specified instances of TimeValue are equal.

public static bool operator !=(TimeValue left, TimeValue right)

Parameters

left TimeValue

The first object to compare.

right TimeValue

The second object to compare.

Returns

bool

true if left is equal to right; otherwise, false.

operator <(TimeValue, TimeValue)

Indicates whether left parameter is less than the right parameter.

public static bool operator <(TimeValue left, TimeValue right)

Parameters

left TimeValue

The left value.

right TimeValue

The right value.

Returns

bool

true if the left parameter is less than the right parameter; otherwise, false.

operator <=(TimeValue, TimeValue)

Indicates whether left parameter is less than or equal to the right parameter.

public static bool operator <=(TimeValue left, TimeValue right)

Parameters

left TimeValue

The left value.

right TimeValue

The right value.

Returns

bool

true if the left parameter is less than or equal to the right parameter; otherwise, false.

operator -(TimeValue, TimeValue)

Subtracts two objects of TimeValue.

public static TimeValue operator -(TimeValue left, TimeValue right)

Parameters

left TimeValue

The first object to sub.

right TimeValue

The second object to sub.

Returns

TimeValue

An object that is the difference of left and right.

operator -(TimeValue)

Produces the negative of TimeValue.

public static TimeValue operator -(TimeValue value)

Parameters

value TimeValue

The value.

Returns

TimeValue

The negative of value.