Time - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Time

 

Calling Sequence

Parameters

Options

Description

Methods

Time Arithmetic

Examples

Compatibility

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

tTime

t<Time: 1970-01-01T00:00:00 + 1709272593173 ms>

(1)

typet&comma;Time

true

(2)

Precisiont

millisecond

(3)

Valuet

1709272593173

(4)

t1NowProcessClock

t1<Time: 253820845 nanosecond>

(5)

typet&comma;Time

true

(6)

Use up some CPU time.

intsinx4&comma;x&colon;

t2NowProcessClock

t2<Time: 559862627 nanosecond>

(7)

evalbt1<t2

true

(8)

typet1+t22&comma;Time

true

(9)

Precisiont2

nanosecond

(10)

tTimeDate

t<Time: 1970-01-01T00:00:00 + 1709272593647 ms>

(11)

typet&comma;Time

true

(12)

GetClockt

<System UTC Clock: Host = rdubtroll4.maplesoft.com>

(13)

Compatibility

• 

The Time command was introduced in Maple 2018.

• 

For more information on Maple 2018 changes, see Updates in Maple 2018.

See Also

Calendar

Clock

Date