TimeInstant class

TimeInstant represents a specific moment in time and its units enable conversion between various time scales.

See the Wikipedia entry for Time for more information.

This class also enables the representation of a point in time to arbitrarily high precision over the entire span of time from the birth of the Universe to a possibly infinite future. Therefore it is suitable for use within science and engineering disciplines that involve very long and/or very short time spans.

Internal Representation in the International Atomic Time Scale

The time instant is represented internally as the number of (SI) seconds elapsed since January 1, 1958 0h 0m 0s, which is the origin of the International Atomic Time Scale (TAI). Unlike other quantities, the notion of an absolute zero time is ill defined. One could specify the time of the Big Bang (creation of the Universe) as time equals zero, but that moment in time is not known precisely. Instead, arbitrary times are chosen to represent zero for a particular time scale and then times are measured against that particular origin. The TAI time scale flows evenly without arbitrary corrections based on the Earth's rotation and is kept to very high precision through statistical analysis of atomic clocks maintained around the world.

Time Systems

TAI - International Atomic Time Scale

A statistical timescale based on a large number of atomic clocks.

UTC - Coordinated Universal Time

The scale used for most official and civilian time keeping.  UTC differs
from TAI by an integral number of seconds; leap seconds are added (or removed)
as necessary to keep UTC within 0.9 seconds of UT1.

system - Used by the Dart VM

The number of milliseconds elapsed since 1 Jan 1970 0h.

Additional time systems are available in the quantity_ext library.

Also available in the time_ext library:

UT1 - Universal Time (1)

   The rotational time of a particular place of observation with
   additional corrections for the affects of polar motion applied.  Because
   the rotation of the Earth is not exactly uniform UT1 does not 'flow'
   uniformly.

UT2 - Universal Time (2)

   UT1 with additional corrections applied for a 'smoother' flow of
   time.

TDT - Terrestrial Dynamical Time (also TT - Terrestrial Time)

   The independent argument of apparent geocentric ephemerides.

TDB - Barycentric Dynamical Time

   A coordinate time having its spatial origin at the center of mass of
   the Earth.

TCG - Geocentric Coordinate Time

   A relativistic coordinate time referred to the geocenter.

TCB - Barycentric Dynamical Time

   A relativistic coordinate time having its spatial origin at the
   solar system barycenter..

JD_* - Julian Date

   The number of days elapsed since 1 Jan 4713 B.C. in a particular time
   scale (e.g., JD_TAI, JD_UTC, etc)

MJD_* - Modified Julian Date

   The Modified Julian Date (Julian Data minus 2400000.5) in a particular time
   scale (e.g., MJD_TAI, MJD_UTC, etc).

GPST - GPS Satellite Time

   The time scale used by the GPS satellites.

NTP - Network Time Protocol

   The time scale used by Internet time servers for synchronization
   purposes.

Besselian

   Used in some astronomy applications.

Synchronizing your system clock to Coordinated Universal Time (UTC):

Software is available for most operating systems that synchronizes its clock to the current UTC within a small fraction of a second using the Network Time Protocol (NTP). For applications--especially distributed applications--that access the system clock and depend on its accuracy, such synchronization is recommended. More information can be found at http://www.ntp.org.

Inheritance
Implementers

Constructors

TimeInstant({dynamic TAI, dynamic UTC, double uncert = 0.0})
Constructs a TimeInstant in either TAI or UTC units. Optionally specify a relative standard uncertainty.
TimeInstant.constant(Number valueSI, {TimeInstantUnits? units, double uncert = 0.0})
Constructs a constant TimeInstant object.
const
TimeInstant.dateTime(DateTime dateTime, {double uncert = 0.0})
Constructs a TimeInstant from an existing dateTime object.
TimeInstant.inUnits(dynamic value, TimeInstantUnits? units, [double uncert = 0.0])
Constructs a TimeInstant based on the value and the conversion factor intrinsic to the passed units.
TimeInstant.misc(dynamic conv)
Constructs an instance without preferred units.

Properties

arbitraryPrecision bool
Whether or not this Quantity is represented using arbitrary precision.
no setterinherited
cgs Number
Returns the value of this quantity in alternative CGS (or centimeter-gram-second) units. MKS (meter-kilogram-second) units are preferred.
no setterinherited
dimensions Dimensions
Dimensions.
finalinherited
fractionOfYear double
Calculates the fraction of the (UTC) year that has elapsed for this time instant to millisecond precision.
no setter
hashCode int
The hash code is based on the value and dimensions. Uncertainty and preferred units are not considered.
no setterinherited
isLeapYear bool
Returns true if the year that contains this TimeInstant is a leap year. Leap years occur every four years except on the hundreds (with the exception of every 400th year).
no setter
isScalar bool
Whether or not this Quantity has scalar dimensions, including having no angle or solid angle dimensions.
no setterinherited
isScalarSI bool
Whether or not this Quantity has scalar dimensions in the strict International System of Units (SI) sense, which allows non-zero angle and solid angle dimensions.
no setterinherited
mks Number
Returns the value of this quantity in standard MKS (or meter-kilogram-second) units.
no setterinherited
nearestDateTime DateTime
Returns a DateTime object that represents as closely as possible the time instant represented by this object. DateTime objects are limited to millisecond precision and cannot describe times very far in the past or future.
no setter
preferredUnits Units?
Preferred units for display.
finalinherited
relativeUncertainty double
The relative standard uncertainty in this Quantity object's value.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
standardUncertainty Quantity
Returns the standard uncertainty in this Quantity object's value as a typed Quantity object.
no setterinherited
valueSI Number
The value of the quantity in the base units, of the International System of Units (SI).
finalinherited

Methods

abs() Quantity
Returns the absolute value of this Quantity. If the value of this Quantity is not negative it is returned directly.
inherited
calcExpandedUncertainty(double k) Quantity
Returns the expanded uncertainty for coverage factor, k, in this Quantity's value as a typed Quantity object.
inherited
compareTo(dynamic q2) int
Compares this Quantity to q2 by comparing MKS values. The Quantities need not have the same dimensions.
inherited
inverse() Quantity
Determines the inverse of the quantity represented by this object, creating and returning a Quantity object (which may have different dimensions and therefore be of a different type). This object is not modified.
inherited
isAfter(TimeInstant when) bool
Tests if this time instant is after the specified time instant.
isBefore(TimeInstant when) bool
Tests if this time instant is before the specified time instant.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outputText(StringBuffer buffer, {UncertaintyFormat uncertFormat = UncertaintyFormat.none, bool symbols = true, NumberFormat? numberFormat}) → void
Appends a String representation of this Quantity to the buffer using the preferred units and number format. If no preferred units have been specified, then MKS units are used. Uncertainty in the value of the Quantity is optionally shown as a plus/minus value in the same units.
inherited
randomSample() Quantity
Randomly generates a Quantity from this Quantity's value and uncertainty. The uncertainty is represented by a Normal (Gaussian) continuous distribution.
inherited
sqrt() Quantity
Returns a Quantity that represents the square root of this Quantity, in terms of both value and dimensions (for example, if this Quantity were an Area of 16 square meters, a Length of 4 meters will be returned).
inherited
toJson() Map<String, dynamic>
Support dart:convert stringify.
inherited
toString() String
Returns a String representation of this Quantity using the preferredUnits. If no preferred units have been specified, then MKS units are used.
inherited
valueInUnits(Units? units) Number
Gets the Quantity's value in the specified units. If units is null, the MKS value is returned. If not null, units must have dimensions compatible with this Quantity or a DimensionsException will be thrown.
inherited

Operators

operator *(dynamic multiplier) Quantity
Returns the product of this quantity and multiplier, which is expected to be either a Quantity, num or Number object. All other types will cause a QuantityException to be thrown.
inherited
operator +(dynamic addend) Quantity
Returns the sum of this Quantity and addend.
inherited
operator -(dynamic subtrahend) Quantity
Override the default Quantity subtraction operator to return a Time when another TimeInstant is subtracted or a TimeInstant when Time is subtracted.
override
operator /(dynamic divisor) Quantity
Returns the quotient of this quantity and divisor, including both value and dimensions.
inherited
operator <(Quantity other) bool
Determines whether on not this Quantity is less than a specified Quantity by comparing their MKS values. The two Quantities need not be of the same type or dimensions.
inherited
operator <=(Quantity other) bool
Determines whether on not this Quantity is less than or equal to a specified Quantity by comparing their MKS values. The two Quantities need not be of the same type or dimensions.
inherited
operator ==(Object obj) bool
Returns true if this Quantity is equal to obj. Two Quantity objects are considered equal if their MKS values and dimensions are equal. Only values and dimensions are considered; other attributes such as uncertainty and preferred units are ignored.
inherited
operator >(Quantity other) bool
Determines whether on not this Quantity is greater than a specified Quantity by comparing their MKS values. The two Quantities need not be of the same type or dimensions.
inherited
operator >=(Quantity other) bool
Determines whether on not this Quantity is greater than or equal to a specified Quantity by comparing their MKS values. The two Quantities need not be of the same type or dimensions.
inherited
operator ^(dynamic exponent) Quantity
Returns this Quantity raised to the power of exponent.
inherited
operator unary-() Quantity
The unary minus operator returns a Quantity whose value is the negative of this Quantity's value.
inherited

Static Properties

system TimeInstantUnits
Number of milliseconds since 1 Jan 1970 0h 0m 0s, which is the System time defined by the Dart VM.
final
TAI TimeInstantUnits
TAI - International Atomic Time
final
UTC TimeInstantUnits
UTC - Coordinated Universal Time
final

Constants

timeInstantDimensions → const Dimensions
Dimensions for this type of quantity