The System UTC Clock
The Process Clock
A clock object provides access to the current time, returning a Time object that represents the moment at which the clock is queried by invoking its Now method.
Each clock is associated with a so-called "epoch", which represents the origin of the time system that the clock implements. The epoch of a clock is accessed via its Epoch method.
The epoch of a clock may be defined or undefined. A clock with an undefined epoch has a definite, but unknown, origin.
Also associated with any clock object is a "precision" that can be queried by using the Precision method of the clock. The precision of a clock represents the fineness with which the clock measures time. It is designated by a unit name denoting the smallest interval of time that may be resolved by the clock. A clock with a smaller unit of precision measures time more precisely than one with a larger unit of precision. For example, a clock with micro-second precision is able to distinguish points in time that differ by one micro-second, and is more precise than a clock with second precision, which can only distinguish points of time that differ by one or more seconds.
The precision of a clock should not be confused with its accuracy. The latter is a measure of how close a measurement is to its true value. The accuracy of a clock cannot be known, in general, as it depends upon the configuration of the underlying operating system and, perhaps, hardware.
Each clock is of type Clock. Use the type command to check whether a Maple expression is of type Clock.
All clocks implement the following methods.
Now returns a Time object representing the current time
Precision returns the name of a unit designating a clock's precision
Epoch returns the epoch of a clock
The most important method of a clock object is the Now method. It returns a Time object representing the moment of time it was invoked, on the time system the clock represents. Numerically, this is a positive or negative count of the number of units of the clock's precision from the epoch of the clock, which may or may not be defined. For a clock with an undefined epoch, it is only meaningful to compare Time values produced by the same clock.
The Precision method of a clock object returns a unit name designating the precision of the clock; that is, the fineness with which the clock measures time.
The Epoch method of a clock returns a value representing the "origin", or zero-point of the time scale measured by that clock. Time values produced by clocks with a defined epoch are comparable and can be combined arithmetically. Time values produced by clocks with an undefined epoch can only be meaningfully compared if they are produced by the same (identical) clock object.
A single object, SystemUTCClock, provides access to the UTC time provided by the underlying operating system.
Because the SystemUTCClock is determined uniquely by the operating system, values produced by it in different Maple processes are expected to agree and can be meaningfully compared and combined.
The ProcessClock object allows you to query the CPU time of the current Maple process. It has an undefined epoch, and a precision (typically nanosecond) determined by the underlying operating system.
The process clock is unique to the Maple process in which it exists. Time values produced by its Now method are meaningful only within a single Maple process. They represent the amount of CPU time elapsed since their epoch, which is a definite, but undefined point in time.
A ThreadClock object allows you to query the CPU time of the current thread in a Maple process. Each ThreadClock has an undefined epoch, and a precision (typically nanosecond) determined by the underlying operating system.
Since thread clocks are unique to the thread in which they are invoked, a different thread clock must be created via a constructor call of the form ThreadClock() in the current thread.
The Clock command was introduced in Maple 2018.
For more information on Maple 2018 changes, see Updates in Maple 2018.
Download Help Document