List of usage examples for com.vaadin.client Util round
public static native double round(double num, int exp) ;
From source file:com.haulmont.cuba.web.toolkit.ui.client.communication.CubaXhrConnection.java
License:Apache License
@Override protected XhrResponseHandler createResponseHandler() { return new XhrResponseHandler() { protected int serverTimeOnClient; @Override/* w ww. java 2s . co m*/ public void onResponseReceived(Request request, Response response) { int statusCode = response.getStatusCode(); if (statusCode == 200) { serverTimeOnClient = (int) Util.round(Profiler.getRelativeTimeMillis() - requestStartTime, 0); } super.onResponseReceived(request, response); } @Override protected void beforeHandlingMessage(ValueMap json) { super.beforeHandlingMessage(json); ScreenClientProfiler profiler = ScreenClientProfiler.getInstance(); String profilerMarker = ScreenClientProfiler.getProfilerMarkerFromJson(json); if (profilerMarker != null) { int serverTimeOnServer = ScreenClientProfiler.getServerTimeFromJson(json); if (serverTimeOnServer > 0) { profiler.registerServerTime(profilerMarker, serverTimeOnServer); profiler.registerNetworkTime(profilerMarker, serverTimeOnClient - serverTimeOnServer); } else { profiler.registerServerTime(profilerMarker, serverTimeOnClient); } profiler.registerEventTs(profilerMarker, ScreenClientProfiler.getEventTsFromJson(json)); } } }; }