Time class
Represents a duration of time.
This is fairly similar to the built-in Duration class, but brings additional granularity to the measurement. Duration, for instance, operates only on integer values, with the smallest granularity being microseconds.
It is possible to convert to this class from Duration instances, or to create Duration instances from instances of this, so long as lossy conversions are acceptable, via the Time.ofDuration and Time.asDuration methods.
- Inheritance
-
- Object
- Measurement<
Time> - Time
Constructors
- Time.infinite()
-
Infinite time.
const
- Time.negativeInfinite()
-
Infinite negative time.
const
- Time.of({num picoseconds = 0, num nanoseconds = 0, num microseconds = 0, num milliseconds = 0, num seconds = 0, num minutes = 0, num hours = 0, num days = 0, Precision precision = Precision.max})
- Time.ofDays(double days, {Precision precision = Precision.max})
- Time.ofDuration(Duration duration, {Precision precision = Precision.max})
- Constructs a Time from a Duration.
- Time.ofHours(double hours, {Precision precision = Precision.max})
- Time.ofMicroseconds(double microseconds, {Precision precision = Precision.max})
- Time.ofMilliseconds(double milliseconds, {Precision precision = Precision.max})
- Time.ofMinutes(double minutes, {Precision precision = Precision.max})
- Time.ofNanoseconds(double nanoseconds, {Precision precision = Precision.max})
- Time.ofPicoseconds(double picoseconds, {Precision precision = Precision.max})
- Time.ofSeconds(double seconds, {Precision precision = Precision.max})
-
Time.sum(Iterable<
Time> parts, {Precision precision = Precision.max}) - Constructs a Time representing the sum of any number of other Times.
- Time.zero()
-
The time of duration zero.
const
Properties
- asDays → double
-
no setter
- asDuration → Duration
-
Constructs a Duration based on this.
no setter
- asHours → double
-
no setter
- asMicroseconds → double
-
no setter
- asMilliseconds → double
-
no setter
- asMinutes → double
-
no setter
- asNanoseconds → double
-
no setter
- asPicoseconds → double
-
no setter
- asSeconds → double
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFinite → bool
-
Returns
true
if this measurement is finite.no setterinherited - isInfinite → bool
-
Returns
true
if this measurement is infinite (either positive or negative).no setterinherited - isNaN → bool
-
Returns
true
if this measurement cannot be expressed as a number.no setterinherited - isNegative → bool
-
Returns
true
if this measurement is negative.no setterinherited - precision → int
-
Returns the number of digits of precision this measurement has.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- si → double
-
The SI value this measurement is based on.
finalinherited
Methods
-
acceptVisitor(
MeasurementVisitor visitor) → void -
Accept a visitor object for double-dispatch.
override
-
as(
TimeInterpreter interpreter) → double - Interprets this using the specified units.
-
compareMagnitude(
Time other) → double -
Returns the difference in magnitude between this and another measurement.
inherited
-
compareTo(
Time other) → int -
Compares this object to another object.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
withPrecision(
Precision precision) → Time -
Creates an equivalent measurement with the specified precision.
inherited
Operators
-
operator *(
double multiplier) → Time -
Returns a measurement equivalent to a multiple of this.
inherited
-
operator +(
Time other) → Time -
Returns a measurement equivalent to the sum of two others.
inherited
-
operator -(
Time other) → Time -
Returns a measurement equivalent to the difference between two others.
inherited
-
operator /(
double divisor) → Time -
Returns a measurement equivalent to a fraction of this.
inherited
-
operator <(
Time other) → bool -
Returns
true
if this is less than the other measurement.inherited -
operator <=(
Time other) → bool -
Returns
true
if this is less than or equal to the other measurement.inherited -
operator ==(
dynamic other) → bool -
The equality operator.
inherited
-
operator >(
Time other) → bool -
Returns
true
if this is greater than the other measurement.inherited -
operator >=(
Time other) → bool -
Returns
true
if this is greater than or equal to the other measurement.inherited -
operator unary-(
) → Time -
Returns a measurement representing the opposite of this.
inherited
-
operator ~/(
Time other) → int -
Returns the truncating division result of this and another measurement.
inherited
Static Properties
- centiseconds → TimeInterpreter
-
final
- days → TimeInterpreter
-
final
- deciseconds → TimeInterpreter
-
final
- dekaseconds → TimeInterpreter
-
final
- hectoseconds → TimeInterpreter
-
final
- hours → TimeInterpreter
-
final
- kiloseconds → TimeInterpreter
-
final
- microseconds → TimeInterpreter
-
final
- milliseconds → TimeInterpreter
-
final
- minutes → TimeInterpreter
-
final
- nanoseconds → TimeInterpreter
-
final
- picoseconds → TimeInterpreter
-
final
- seconds → TimeInterpreter
-
final