Time - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Date and Time : Time

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

Time1552127221504&comma;1&comma;clock&equals;module...end module

(1)

typet&comma;&apos;Time&apos;

true

(2)

Precisiont

millisecond

(3)

Valuet

1552127221504

(4)

t1NowProcessClock

Time237465606&comma;1&comma;clock&equals;module...end module

(5)

typet&comma;&apos;Time&apos;

true

(6)

Use up some CPU time.

&int;sinx4&DifferentialD;x&colon;

t2NowProcessClock

Time411669812&comma;1&comma;clock&equals;module...end module

(7)

evalbt1<t2

true

(8)

typet1&plus;t22&comma;&apos;Time&apos;

true

(9)

Precisiont2

nanosecond

(10)

tTimeDate

Time1552127222177&comma;1&comma;clock&equals;module...end module

(11)

typet&comma;&apos;Time&apos;

true

(12)

GetClockt

SystemUTCClock

(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