05-13-2008 6:08 AM
I have written a simple program:
1, Assign sy-uzeit to a time variable: tm_start
2, Loop 100000 times
3, Get the seconds difference between current sy-uzeit and tm_start
The difference is always 0 even if the loop runs moe than a minute.
If I debug the program, sy-uzeit is only initialized in the beginning of the problem.
During the program, it will not be updated anymore.
Does anyone know how to update sy-uzeit to make it up-to-date?
Thanks.
05-14-2008 10:59 AM
Hi Atish,
Thanks for your input.
I have the same understanding as you before I create this testing program.
If you run my program, debug and stop at do loop for more than a minute, you can find the strange result.
05-13-2008 6:11 AM
do one thing... send the sy-uzeit into a varaible vl_initial... and send the time to vl_final after the loop and check the difference... it should be an alternative...
vl_initial = sy-uzeit.
loop at
endloop.
vl_final = sy-uzeit.
write:/ 'diff:' , vl_final - vl_intial.
05-13-2008 6:19 AM
assign sy-uzeit to a varaible v_timevl_initial = sy-uzeit.
loop at
v_timevl_initial = sy-uzeit.
write:/ 'diff:' , vl_final - v_timevl_initial .
endloop.
05-13-2008 6:19 AM
Thanks for the update.
This is my program:
tm_start = sy-uzeit.
BREAK-POINT.
DO 100000 TIMES.
ENDDO.
tm_diff = sy-uzeit - tm_start.
WRITE / tm_diff.
The tm_diff is always 0.
So that's why I suspected that the sy_uzeit is only initiated once.
Hope I have explained myself clearly this time.
_
05-14-2008 11:04 AM
data tm_start type sy-uzeit.
data tm_diff type sy-uzeit.
tm_start = sy-uzeit.
wait up to 10 seconds.
tm_diff = sy-uzeit - tm_start.
WRITE / tm_diff.
05-14-2008 11:05 AM
sy-uzeit is fixed throughout the run of a program unless you use GET TIME.
GET TIME sets sy-uzeit to the current time.
matt
05-14-2008 2:47 AM
05-14-2008 3:12 AM
05-14-2008 4:08 AM
Thanks Atish.
The statement, which is provided by you, need the DDIC data type to store the time stamp result.
And it does serve the purpose.
But regarding my question about sy-uzeit, do you have any clarification for it?
05-14-2008 4:33 AM
Hi David,
It is not that sy-uzeit is intialized once. The reason as why you are getting difference always zero is the difference is less than a second. Sy-uzeit can have minimum value as Seconds only. It can't have milliseconds or microseconds thats why I suggested the other keywords.
Regards,
Atish
05-14-2008 10:59 AM
Hi Atish,
Thanks for your input.
I have the same understanding as you before I create this testing program.
If you run my program, debug and stop at do loop for more than a minute, you can find the strange result.
05-14-2008 11:28 AM
HI,
try like this.
DATA:tm_start TYPE SY-UZEIT,
tm_end TYPE sy-uzeit,
tm_diff(2).
GET TIME FIELD tm_start.
DO 10000 TIMES.
ENDDO.
GET TIME FIELD tm_end.
tm_diff = tm_end - tm_start.
WRITE:/ tm_diff.
rgds,
bharat.
05-15-2008 4:03 AM
Hi Matt,
Your answer is quite helpful.
And it's the answer that I'm chasing by this post.
Anyway, I'm a newbie.
So Bharat's source code is more understandable for me.
Hence I marked Bharat's answer as solved problem at the first glance.
Thank you so much for your great help!
David.
05-15-2008 9:13 AM
Fine - I'm not a points hunter! But your question was re an already written program.
>I have written a simple program:
>1, Assign sy-uzeit to a time variable: tm_start
>2, Loop 100000 times
>3, Get the seconds difference between current sy-uzeit and >tm_start
>The difference is always 0 even if the loop runs moe than a minute.
All you had to do with your already written program was use GET TIME, on it's own, with no additions, before you read sy-uzeit.
Cheers
matt