Time - Maple Help

Time

 Calling Sequence Time() Time( d )

Parameters

 d - Date; a Date object expr - numeric; a clock value, in multiples of the precision from the clock epoch

Options

 • clock : Clock; a Clock object
 • moment : numeric

Description

 • A Time object represents an exact moment of time with respect to a particular time scale, defined by an associated Clock.
 • Time objects are created by Clock objects by invoking their Now methods, but can also be created from Date objects, or through arithmetic using existing Time objects. In addition, a Time object can be created by a direct constructor call, as above; however, users will not ordinarily need to use a Time constructor call.
 • If called without arguments, the Time() command returns an Time object representing the current time on the default clock, the system "UTC" clock. (See Clock.)
 • An expression of the form Time( d ), with d a Date object converts the Date object to a Time object representing the same moment in time, with respect to the system UTC clock.
 • In addition, you can create a Time object explicitly by passing the 'moment' = expr option, which creates a Time object representing expr multiples of the precision of the clock from the epoch. By default, the clock associated with the Time object is the system UTC clock, but the 'clock' = c option can be passed to specify a different Clock object.
 • The moment and clock options are not used when the Time object constructor is called with a Date object as argument.

Methods

 • The following utility methods are supported by Time objects.

 Epoch  the epoch of the time system Value  the count value for this Time object GetClock  returns the clock associated with this Time object Precision  return the precision of the clock associated with this Time object

Time Arithmetic

 • Time objects may be added and subtracted, and can be compared by using the < and <= operators.
 • It is an error to attempt to form arithmetic combinations of Time objects with incompatible clocks. Suppose that t1 and t2 are Time objects. Then the clocks of t1 and t2 are compatible if both have defined epochs or, if both have undefined epochs, and their clocks are identical.
 • Only affine combinations of Time objects evaluate to a Time object. Convex combinations of Time objects evaluate to an expression of the form nu, where n is numeric, and u is a unit expressing the precision of the Time objects involved.

Examples

 > $t≔\mathrm{Time}\left(\right)$
 ${\mathrm{Time}}{}\left({1615256555704}{,}{1}{,}{\mathrm{clock}}{=}\left({\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right)\right)$ (1)
 > $\mathrm{type}\left(t,'\mathrm{Time}'\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{Precision}\left(t\right)$
 ${\mathrm{millisecond}}$ (3)
 > $\mathrm{Value}\left(t\right)$
 ${1615256555704}$ (4)
 > $\mathrm{t1}≔\mathrm{Now}\left(\mathrm{ProcessClock}\right)$
 ${\mathrm{Time}}{}\left({240873125}{,}{1}{,}{\mathrm{clock}}{=}\left({\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right)\right)$ (5)
 > $\mathrm{type}\left(t,'\mathrm{Time}'\right)$
 ${\mathrm{true}}$ (6)

Use up some CPU time.

 > $\mathrm{int}\left(\mathrm{sin}\left({x}^{4}\right),x\right):$
 > $\mathrm{t2}≔\mathrm{Now}\left(\mathrm{ProcessClock}\right)$
 ${\mathrm{Time}}{}\left({470340615}{,}{1}{,}{\mathrm{clock}}{=}\left({\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right)\right)$ (7)
 > $\mathrm{evalb}\left(\mathrm{t1}<\mathrm{t2}\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{type}\left(\frac{\mathrm{t1}+\mathrm{t2}}{2},'\mathrm{Time}'\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{Precision}\left(\mathrm{t2}\right)$
 ${\mathrm{nanosecond}}$ (10)
 > $t≔\mathrm{Time}\left(\mathrm{Date}\left(\right)\right)$
 ${\mathrm{Time}}{}\left({1615256556332}{,}{1}{,}{\mathrm{clock}}{=}\left({\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}\right)\right)$ (11)
 > $\mathrm{type}\left(t,'\mathrm{Time}'\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{GetClock}\left(t\right)$
 ${\mathrm{SystemUTCClock}}$ (13)
 > 

Compatibility

 • The Time command was introduced in Maple 2018.