From: Vladimír Vondruš Date: Thu, 8 Mar 2018 10:28:28 +0000 (+0100) Subject: Build status: no point in showing long stuff like 117 minutes. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=cd1628b0caaaf675a7530527fe673372e170a144;p=blog.git Build status: no point in showing long stuff like 117 minutes. --- diff --git a/doc/build-status.js b/doc/build-status.js index f92da95b..074d5bea 100644 --- a/doc/build-status.js +++ b/doc/build-status.js @@ -13,11 +13,11 @@ if(location.search) { function timeDiff(before, now) { var diff = now.getTime() - before.getTime(); - /* Try days first. If less than two days, try hours. If less than two - hours, try minutes. If less than a minute, say "now". */ - if(diff/(24*60*60*1000) > 2) + /* Try days first. If less than a day, try hours. If less than an hour, try + minutes. If less than a minute, say "now". */ + if(diff/(24*60*60*1000) > 1) return Math.round(diff/(24*60*60*1000)) + "d ago"; - else if(diff/(60*60*1000) > 2) + else if(diff/(60*60*1000) > 1) return Math.round(diff/(60*60*1000)) + "h ago"; else if(diff/(60*1000) > 1) return Math.round(diff/(60*1000)) + "m ago";