The INTERVAL-TIMER function returns the number of seconds starting from an arbitrary point in time. Typically, you will want to use the function twice or more in order to take differences between the return values in order to time something.
Another potential use would be to obtain a higher-resolution timestamp to distinguish items with identical keys.
The return value is not an integer. The exact precision varies widely between systems, but should be at minimum one microsecond (higher for most machines). A variable with at least four digits after the decimal point is recommended to hold the result (though that is not required). Floating point would also be a recommended variable type.
The return value by itself has no preset meaning; it is just an arbitrary number of seconds, measuring real time (as opposed to CPU-only time). Compare it to a second return value for meaning. If the host system does not have an appropriate timer available, then the function will always return a value of zero.
Normally, the timer will only increase in value for any one process. In some implementations, the timer may reset to zero at midnight.
The following example shows how, by setting an arbitrary starting point (the result of the something-long section), you can use the interval-timer function to measure time elapsed.
working-storage section. 77 start-time double. 77 elapsed-time double. 77 display-time pic zzzz.9(4). 77 dummy pic 9(3)9(6). procedure division. main-logic. display standard window. display "Running..." move function interval-timer to start-time perform something-long compute elapsed-time = function interval-timer - start-time move elapsed-time to display-time display "Something-Long took ", display-time, " seconds to run" accept omitted. stop run. something-long. perform 1000000 times compute dummy = function sqrt(123) end-perform.