%DIFF Issue Utilizing Milliseconds
Posted: Sat Feb 03, 2024 11:28 pm
I have a program that needs to calculate the amount of seconds for the Data Queue Wait time. The program runs queries every 3 minutes and takes directives through the data queue so the processing time needed to process those directives is subtracted from the Data Queue Wait Time so that the queries will run on time. I know to get seconds from milliseconds you divide the milliseconds by 1000 but that doesn't work here. The difference between the timestamps is 7.1 seconds. In order to arrive at that value, the program has to divide the milliseconds value by 1,000,000. Why? I don't use seconds because it rounds down and I only want it to round down if the tenths are less than .4.
I would also like some tips on how to format the code here even though I put it inside the code block but Scott says it is messy and hard to read. Thanks!
I would also like some tips on how to format the code here even though I put it inside the code block but Scott says it is messy and hard to read. Thanks!
Code: Select all
Dcl-S l_milliSeconds Packed(15:5);
Dcl-S l_seconds Packed(15:5);
G_DIRENDTIME = '2024-02-03-16.44.33.512000'
G_DIRSTARTTIME = '2024-02-03-16.44.26.412000'
l_milliSeconds = %Diff(g_dirEndTime:g_dirStartTime:*MSECONDS);
l_seconds = l_milliSeconds / 1000;
L_MILLISECONDS = 0007100000.00000
L_SECONDS = 0000007100.00000