Calculating time difference in Milliseconds

前端 未结 9 546
谎友^
谎友^ 2020-12-04 21:42

I am making a call to a method by passing ipAddress and it will return back the location of ipAddress like Country, City, etc etc. So I was trying to see how much time it is

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 22:12

    Try this

    long start_time = System.nanoTime();
    resp = GeoLocationService.getLocationByIp(ipAddress);
    long end_time = System.nanoTime();
    double difference = (end_time - start_time) / 1e6;
    

提交回复
热议问题