Milliseconds
JOHNBONZ
Posts: 99
I am trying to get Netlinx to show milliseconds like you would in Java:
Java:
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
System.out.println("Calender - Time in milliseconds : " + calendar.getTimeInMillis());
Result:
Calender - Time in milliseconds : 1421893256000
Does anyone know how to do so? I tried in Timeline event
Netlinx:
TimeLine= TL_ET
long lRunTime;
lRunTime = TIMELINE_GET(TL_ET)
send_string 0,"lRunTime=',ITOA(lRunTime)";
Result:
lRunTime=6
returns single digit -- I want milliseconds - anyone know how to do this?
Java:
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
System.out.println("Calender - Time in milliseconds : " + calendar.getTimeInMillis());
Result:
Calender - Time in milliseconds : 1421893256000
Does anyone know how to do so? I tried in Timeline event
Netlinx:
TimeLine= TL_ET
long lRunTime;
lRunTime = TIMELINE_GET(TL_ET)
send_string 0,"lRunTime=',ITOA(lRunTime)";
Result:
lRunTime=6
returns single digit -- I want milliseconds - anyone know how to do this?
0
Comments
Have your tried FTOA? Another thought might be to load the value into a global variable and look at it in debug and see what the value(s) is/are.
TELNET WINDOW
>msg on (in Bold is the millisencds)
(0001284161) INSIDE lRunTime=6
(0001284162)
(0001284163) LOOP MAIN TIMELINE TL_ET
(0001284163)
(0001284164) EVENT INDEX I=1
(0001284165) LOOP nProcessSceneET=0
I guess I'm confused. I do code math and so forth on "right of the decimal point" all the time. You use FLOAT variables.
You can do things like
IF(fMy_Float_Number=0.003){//do something}
Here's the text from the help file:
FLOAT defines an intrinsic data type representing a 64-bit signed floating-point value. It is used to store small real numbers with 5 digits of precision.
EDIT: I just realized you are referring to actual time and not time elapsed, sorry this wont work for you.
Matt in your example, wouldn't it be nice to call a function, and at the top of function display start time, then at the end display how long process or function took to run in milliseconds. The example below does this but in 1/10 of a second so the values maybe the same if process takes less than 1/10 of a second
FUNCTION.....
"'START SORT CURRENT TIME =',ITOA(GET_TIMER)";
.
.
.
.
"'END SORT CURRENT TIME =',ITOA(GET_TIMER)";
Line 1 (09:27:21):: 0 sec: lRunTime=0
Line 2 (09:27:21):: Memory Available = 208615600 <23704>
Line 3 (09:27:22):: 1 sec: lRunTime=1001
Line 4 (09:27:31):: 10 sec: lRunTime=9998
Line 5 (09:27:31):: 1 - 0: 1001
Line 6 (09:27:31):: 10 - 0: 9998
Line 7 (09:27:31):: 10 - 1: 8997
Line 8 (09:28:14):: 0 sec: lRunTime=53600
Line 9 (09:28:15):: 1 sec: lRunTime=54599
Line 10 (09:28:24):: 10 sec: lRunTime=63596
Line 11 (09:28:24):: 1 - 0: 999
Line 12 (09:28:24):: 10 - 0: 9996
Line 13 (09:28:24):: 10 - 1: 8997
Line 14 (09:30:29):: 0 sec: lRunTime=188016
Line 15 (09:30:30):: 1 sec: lRunTime=189020
Line 16 (09:30:39):: 10 sec: lRunTime=198017
Line 17 (09:30:39):: 1 - 0: 1004
Line 18 (09:30:39):: 10 - 0: 10001
Line 19 (09:30:39):: 10 - 1: 8997