Time Calculation
<p>I am on a time calculation to calculate a delay time for a train
Schedule time : t1
Arrival time : t2</p>

<pre><code>function tomdiff(t1,t2) {
    var t1 = hour2mins(t1);  var t2=hour2mins(t2);
    var ret = mins2hour(parseInt(t2-t1));
    if(t2&lt;t1) {ret=mins2hour(parseInt(parseInt(t2+1440)-t1));}
    return ret;
}

//Calculate on Key up
    $("input.[rel=time1]").keyup(function (b){ $("#delaytime").val(tomdiff($("#schedule").val(),$("#arrival").val())); }); 
</code></pre>

<p>This is working great but what if the train arrive earlier!</p>

<p>Can someone advise me?</p>
