Skip to content

Commit 88abe87

Browse files
authored
implement td_add() (#1009)
1 parent 6d22735 commit 88abe87

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/date_time/cl_abap_tstmp.clas.abap

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ CLASS cl_abap_tstmp IMPLEMENTATION.
9292
ENDMETHOD.
9393

9494
METHOD td_add.
95-
ASSERT 1 = 'todo'.
95+
96+
DATA(td) = add(
97+
tstmp = |{ date }{ time }|
98+
secs = secs ).
99+
100+
CONVERT TIME STAMP td INTO DATE res_date TIME res_time.
101+
96102
ENDMETHOD.
97103

98104
METHOD systemtstmp_utc2syst.

src/date_time/cl_abap_tstmp.clas.testclasses.abap

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CLASS ltcl_test DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
1111
METHODS systemtstmp_syst2utc_initial FOR TESTING RAISING cx_static_check.
1212
METHODS move_to_short1 FOR TESTING RAISING cx_static_check.
1313
METHODS td_subtract1 FOR TESTING RAISING cx_static_check.
14+
METHODS td_add1 FOR TESTING RAISING cx_static_check.
1415

1516
ENDCLASS.
1617

@@ -170,4 +171,28 @@ CLASS ltcl_test IMPLEMENTATION.
170171
exp = 600 ).
171172
ENDMETHOD.
172173

174+
METHOD td_add1.
175+
176+
DATA lv_date TYPE d.
177+
DATA lv_time TYPE t.
178+
179+
cl_abap_tstmp=>td_add(
180+
EXPORTING
181+
date = '20250505'
182+
time = '111111'
183+
secs = 100
184+
IMPORTING
185+
res_date = lv_date
186+
res_time = lv_time ).
187+
188+
cl_abap_unit_assert=>assert_equals(
189+
act = lv_date
190+
exp = '20250505' ).
191+
192+
cl_abap_unit_assert=>assert_equals(
193+
act = lv_time
194+
exp = '111251' ).
195+
196+
ENDMETHOD.
197+
173198
ENDCLASS.

0 commit comments

Comments
 (0)