Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:jeffsu/upbeat into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsu committed Sep 12, 2012
2 parents 3047307 + 627e6d1 commit f3d8952
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions www/htime.ms
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export class HumanTime {
var ret = [];
foreach (var v:i in VALS) {
var amount = Math.floor(ms / v);
console.log(UNITS[i], ms / v, ms, v);
ms -= amount * v;
if (amount > 0) ret.push(amount + UNITS[i]);
if (amount > 0 || i == 3) ret.push(amount + UNITS[i]);
}

return ret.join(' ');
Expand All @@ -41,9 +42,9 @@ export class HumanTime {
return (n < 10 ? "0" : '') + n;
}

function dateTime(t) {
if (typeof t != 'number') return '';
var d = new Date(t);
function dateTime(d) {
// if (typeof t != 'number') return '';
// var d = new Date(t);
var date = [d.getMonth(), d.getDay(), d.getFullYear()].join('-');
var minute = this.pad(d.getMinutes());
var second = this.pad(d.getSeconds());
Expand Down
4 changes: 2 additions & 2 deletions www/views/_services.jade
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ table.table.table-condensed.table-bordered
!= health(sensor.isHealthy)
span.inlinesparkline= sensor.getAvgResponse('hour').join(',');
td #{sensor.passCount}/#{sensor.totalCount}
td= htime.timeDistance(sensor.lastPass) + ' ago';
td= htime.timeDistance(sensor.lastFail) + ' ago';
td= htime.humanizeAgo(sensor.lastPass);
td= htime.humanizeAgo(sensor.lastFail);

:mochi
$(function() {
Expand Down
2 changes: 1 addition & 1 deletion www/views/sensor.jade
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ block content
td= sensor.status
th Last Failure
td
= sensor.lastFailure
= htime.dateTime(sensor.lastFailure);
if sensor.lastError
= " (" + sensor.lastError.toString() + ")";
tr
Expand Down

0 comments on commit f3d8952

Please sign in to comment.