utclong_diff - Time Stamp Function
... utclong_diff( high = time_stamp2
low = time_stamp1 ) ...
This function calculates the time difference between the values of two time stamp fields
time_stamp1. The return value has the type
and contains the precise difference in seconds rounded to seven decimal places. If the time stamp in
time_stamp2 is later than the time stamp in
the result is positive. If the values are identical, the result is 0. In all other cases, the result is negative.
Time stamp fields of the type
containing valid time stamps must be passed to the arguments
time-stamp-like expression positions. An initial time stamp is handled like the lowest possible value of a time stamp.
- The system class CL_ABAP_UTCLONG contains a method DIFF with multiple output parameters for days, hours, minutes, and seconds (across which the time difference is spread) instead of just one return parameter.
- If the function
utclong_diffis used as an operand of an arithmetic expression, the calculation type
- If the function
utclong_diffis used as the right side of an assignment or other operand positions in which the return value is converted, the decimal places are converted in accordance with the general conversion rules for source field type
decfloat34, if necessary, and are not cut off. If the decimal places are to be cut off, the built-in function
trunccan be applied to the return value.
Calculates the time interval in microseconds between successive time stamps from an internal table.
DATA time_stamps TYPE TABLE OF utclong WITH EMPTY KEY. time_stamps = VALUE #( FOR i = 1 UNTIL i > 11 ( utclong_current( ) ) ). cl_demo_output=>write( time_stamps ). TYPES diffs TYPE TABLE OF decfloat34 WITH EMPTY KEY. cl_demo_output=>display( VALUE diffs( FOR _ts IN time_stamps FROM 2 INDEX INTO i ( utclong_diff( high = _ts low = time_stamps[ i - 1 ] ) * 1000000 ) ) ).
Cause: A time stamp specified for
Cause: An argument without a time stamp type is passed to