Is it possible using jQuery/Javascript to calculate the estimated load time of a page?

I've tried the following which I found somewhere online but the time increments on each reload by 200 and when it gets to 6000 it resets back to 0

```
var perfData = window.performance.timing,
    EstimatedTime = -(perfData.loadEventEnd - perfData.navigationStart),
    time = parseInt((EstimatedTime/1000)%60)*100;

if (time >= 700) {
    $(window).load(function() {
        // Do something
    });
} else {
    // Do something else
}

```

I wanted it to use a preloader if the estimated page load time was 700ms or more.