Skip to main content

TIME

Returns the current local system time in internal format.

Synopsis

TIME()

Arguments

None. The parentheses are mandatory.

Description

The TIME function returns the current local time in a format such as the following:

29848.349

This represents the elapsed number of seconds since midnight, with fractional seconds. This is the same local time returned by SYSTEM(12). The only difference is that TIME displays the count in elapsed seconds and fractional milliseconds; SYSTEM(12) displays the count in elapsed milliseconds.

The ICONV function can convert a time value with fractional seconds from display format to an internal count of elapsed seconds since midnight with fractional seconds. All other time and date functions use whole seconds as the smallest unit of time.

TIME, TIMEDATE, SYSTEM(12), and @TIME all return a local time value. SYSTEM(99) returns a Coordinated Universal Time (UTC) time value.

Caché MultiValue determines local time (and date) as follows:

  • It determines the current Coordinated Universal Time (UTC) from the system clock.

  • It adjusts UTC to the local time zone by using the value of the Caché special variable $ZTIMEZONE.

  • It applies local time variant settings (such as Daylight Saving Time) for that time zone from the host operating system.

Note:

The local time returned by the TIME function is not the same as the local time returned by the @TIME system variable. Both return time in elapsed seconds since midnight. However, TIME returns the current time. @TIME returns the time of invocation of the current routine; the @TIME value does not change during the execution of the current routine. When issued from the MultiValue Shell, @TIME contains the time that the last (prior) command line was invoked. For further details, see the System Variables page of this manual.

Examples

The following example calls the TIME function to return the current system time in internal format, then uses the OCONV function to convert time from internal format to display format. Note that OCONV conversion truncates fractional seconds.

now=TIME()
PRINT now
PRINT OCONV(now,"MTS")

The following example shows the difference between the TIME function and the @TIME system variable:

SLEEP 2
PRINT @TIME,TIME()

The TIME function returns the current time; the @TIME variable returns the time that the SLEEP command was invoked.

See Also

FeedbackOpens in a new tab