Skip to main content

$ZHOROLOG

Contains the number of seconds elapsed since Caché startup.

Synopsis

$ZHOROLOG
$ZH

Description

$ZHOROLOG contains the number of seconds that have elapsed since the most recent Caché startup. This is a count, which is independent of clock changes and day boundaries. The value is expressed as a floating point number, indicating seconds and fractions of a second. The number of decimal digits is platform-dependent. $ZHOROLOG truncates trailing zeros in this fractional portion.

This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.

Note:

Because of a limitation in the Windows operating system, putting your Windows system into hibernate or standby mode may cause $ZHOROLOG to return unpredictable values. This problem does not affect $HOROLOG or $ZTIMESTAMP values.

Examples

This example outputs the current $ZHOROLOG value.

   WRITE $ZHOROLOG

returns a value such as: 1036526.244932.

The following example shows how you might use $ZHOROLOG to time events and do benchmarks. This example times an application through 100 executions, then finds the average runtime.

Cycletime
  SET start=$ZHOROLOG
    FOR i=1:1:100 { DO Myapp }
  SET end=$ZHOROLOG
  WRITE !,"Average run was ",(end-start)/100," seconds."
   QUIT
Myapp
   WRITE !,"executing my application"
  ; application code goes here
   QUIT

See Also

FeedbackOpens in a new tab