Time Type

Use the Time primitive type to declare a variable representing the time of day since midnight to the nearest millisecond.

If you declare a Time primitive type variable in your method that is referenced within the code of the method, it is initialized with the current time each time the method is invoked. If such a local variable is declared but is not referenced in the code, its value is not initialized. Object properties of Time primitive type are initialized to null.

In JADE thin client mode, local variables of type Time are always initialized to the time relative to the presentation client.

The following example shows the use of the Time primitive type.

testTime();
vars
    time     : Time;
    h,m,s,ms : Integer;
begin
    h  := 15;
    m  := 39;
    s  := 06;
    ms := 45;
    time.setTime(h, m, s, ms);
    write time;               // Outputs 15:39:06
end;

The following table lists valid operations for the Time primitive type.

Expression Expression Type
time-expression + integer-expression (time)
time-expression - integer-expression (time)
time-expression + time-expression (time)
time-expression - time-expression (integer)
time-expression + timestamp-expression (timestamp)

The following example, in which 10 minutes is added to a Time primitive type variable, uses a millisecond integer value.

time := time + 600000            // 10 * 60 * 1000

If you add 60000 milliseconds (one minute) to a time variable and the assigned time is later than 23:59:59:999, the resulting value is 00:00:59:999 or later.

For details about the methods defined in the Time primitive type, see "Time Methods", in the following subsection.

For details about converting primitive types, see "Converting Primitive Types", in Chapter 1 of the JADE Developer’s Reference.