i am using nanoTime() as timestamps to create an interval to execute a certain method like this:
i want my loop (number) to be every 5 seconds. Considering that 1 millisecond is equal to 1000000 nanoseconds, i thought i should add 1000 000 000 as number, but it wasn't correct.
My problem is i cannot interpret the nanoTime() output. i dont want to convert for precision issues.
Code:
long start=System.nanoTime();
Log.d("time", "time "+start);
Log.d("time", "time "+start/1000000);
while(true)
{
long end=System.nanoTime();
Log.d("end", "end "+end);
Log.d("end", "end "+end/1000000);
if(end>=start+number)
{
method();
start=end;
}
}
My problem is i cannot interpret the nanoTime() output. i dont want to convert for precision issues.