All files / output zcl_abapgit_git_time.clas.mjs

67.07% Statements 55/82
50% Branches 4/8
21.42% Functions 3/14
67.07% Lines 55/82

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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 821x 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 1x   1x     1x 1x 1x 1x 1x 1x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_git_time.clas.abap
class zcl_abapgit_git_time {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_GIT_TIME';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"GET_UNIX": {"visibility": "U", "parameters": {"RV_TIME": {"type": () => {return new abap.types.Character(16, {"qualifiedName":"zcl_abapgit_git_time=>ty_unixtime"});}, "is_optional": " "}}},
  "GET_ONE_YEAR_AGO": {"visibility": "U", "parameters": {"RV_TIME": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}}},
  "GET_UTC": {"visibility": "U", "parameters": {"IV_UNIX": {"type": () => {return new abap.types.Character(16, {"qualifiedName":"zcl_abapgit_git_time=>ty_unixtime"});}, "is_optional": " "}, "EV_DATE": {"type": () => {return new abap.types.Date();}, "is_optional": " "}, "EV_TIME": {"type": () => {return new abap.types.Time();}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async get_one_year_ago() {
    return zcl_abapgit_git_time.get_one_year_ago();
  }
  static async get_one_year_ago() {
    let rv_time = new abap.types.Integer({qualifiedName: "I"});
    let lc_epoch = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    lc_epoch.set('19700101000000');
    let lv_time = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    abap.statements.getTime({stamp: lv_time});
    rv_time.set((await abap.Classes['CL_ABAP_TSTMP'].subtract({tstmp1: lv_time, tstmp2: lc_epoch})));
    rv_time.set(abap.operators.minus(rv_time,new abap.types.Integer().set(31536000)));
    return rv_time;
  }
  async get_unix() {
    return zcl_abapgit_git_time.get_unix();
  }
  static async get_unix() {
    let rv_time = new abap.types.Character(16, {"qualifiedName":"zcl_abapgit_git_time=>ty_unixtime"});
    let lc_epoch = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    lc_epoch.set('19700101000000');
    let lv_time = new abap.types.Packed({length: 15, decimals: 0, qualifiedName: "TIMESTAMP"});
    let lv_seconds = new abap.types.Integer({qualifiedName: "I"});
    abap.statements.getTime({stamp: lv_time});
    lv_seconds.set((await abap.Classes['CL_ABAP_TSTMP'].subtract({tstmp1: lv_time, tstmp2: lc_epoch})));
    rv_time.set(lv_seconds);
    abap.statements.condense(rv_time, {nogaps: false});
    new abap.OffsetLength(rv_time, {offset: 11}).set(abap.CharacterFactory.get(7, '+000000'));
    return rv_time;
  }
  async get_utc(INPUT) {
    return zcl_abapgit_git_time.get_utc(INPUT);
  }
  static async get_utc(INPUT) {
    let iv_unix = INPUT?.iv_unix;
    if (iv_unix?.getQualifiedName === undefined || iv_unix.getQualifiedName() !== "ZCL_ABAPGIT_GIT_TIME=>TY_UNIXTIME") { iv_unix = undefined; }
    if (iv_unix === undefined) { iv_unix = new abap.types.Character(16, {"qualifiedName":"zcl_abapgit_git_time=>ty_unixtime"}).set(INPUT.iv_unix); }
    let ev_date = INPUT?.ev_date || new abap.types.Date();
    let ev_time = INPUT?.ev_time || new abap.types.Time();
    let lc_epoch = new abap.types.Date({qualifiedName: "D"});
    lc_epoch.set('19700101');
    let lv_i = new abap.types.Integer({qualifiedName: "I"});
    let lv_utcdiff = new abap.types.Time({qualifiedName: "T"});
    let lv_utcsign = new abap.types.Character(1, {});
    lv_i.set(iv_unix.getOffset({length: 10}));
    lv_utcsign.set(iv_unix.getOffset({offset: 11}));
    lv_utcdiff.set(iv_unix.getOffset({offset: 12}));
    let unique172 = lv_utcsign;
    if (abap.compare.eq(unique172, abap.CharacterFactory.get(1, '+'))) {
      lv_i.set(abap.operators.add(lv_i,lv_utcdiff));
    } else if (abap.compare.eq(unique172, abap.CharacterFactory.get(1, '-'))) {
      lv_i.set(abap.operators.minus(lv_i,lv_utcdiff));
    }
    ev_time.set(abap.operators.mod(lv_i,new abap.types.Integer().set(86400)));
    lv_i.set(abap.operators.minus(lv_i,ev_time));
    lv_i.set(abap.operators.divide(lv_i,new abap.types.Integer().set(86400)));
    ev_date.set(abap.operators.add(lv_i,lc_epoch));
  }
}
abap.Classes['ZCL_ABAPGIT_GIT_TIME'] = zcl_abapgit_git_time;
zcl_abapgit_git_time.ty_unixtime = new abap.types.Character(16, {"qualifiedName":"zcl_abapgit_git_time=>ty_unixtime"});
export {zcl_abapgit_git_time};