All files / src/utils zcl_abapgit_time_date.clas.abap

100% Statements 44/44
50% Branches 1/2
100% Functions 1/1
100% Lines 44/44

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 451x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
CLASS zcl_abapgit_time_date DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
 
  PUBLIC SECTION.
 
    CLASS-METHODS get_system_timezone
      RETURNING
        VALUE(rv_timezone) TYPE timezone .
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
 
 
 
CLASS zcl_abapgit_time_date IMPLEMENTATION.
 
 
  METHOD get_system_timezone.
* returns the time zone of the application server,
* CL_ABAP_TSTMP=>GET_SYSTEM_TIMEZONE does not exist in lower releases,
* and the function module is not released for ABAP Cloud, so call both dynamically
 
    DATA lv_fm TYPE string.
 
    lv_fm = 'GET_SYSTEM_TIMEZONE'.
 
    TRY.
        CALL METHOD ('CL_ABAP_TSTMP')=>get_system_timezone
          RECEIVING
            system_timezone = rv_timezone.
      CATCH cx_sy_dyn_call_illegal_method.
        CALL FUNCTION lv_fm
          IMPORTING
            timezone            = rv_timezone
          EXCEPTIONS
            customizing_missing = 1
            OTHERS              = 2.
        ASSERT sy-subrc = 0.
    ENDTRY.
 
  ENDMETHOD.
ENDCLASS.