From 809e6559569cdd40f73f40718da1d387333477d1 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Mon, 11 Oct 2010 15:17:09 +0000 Subject: [PATCH] round hours to 2 decimal places in emails --- bf-alerts.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bf-alerts.pl b/bf-alerts.pl index 2784f7a..c118cc4 100755 --- a/bf-alerts.pl +++ b/bf-alerts.pl @@ -205,7 +205,7 @@ foreach my $clearme (@need_cleared) my $text; if ($setting) { - my $hours = ($now - $sysbranch->{snapshot}) / 3600; + my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); $text = "$sysbranch->{sysname} has now reported " . "on $sysbranch->{branch} $hours hours ago."; } @@ -239,7 +239,7 @@ foreach my $clearme (@need_alerts) { my ($sysbranch, $setting) = @$clearme; my ($animal, $branch) = ($sysbranch->{sysname},$sysbranch->{branch}); - my $hours = ($now - $sysbranch->{snapshot}) / 3600; + my $hours = sprintf("%.2f",($now - $sysbranch->{snapshot}) / 3600); my $text = "$sysbranch->{sysname} has not reported " . "on $sysbranch->{branch} for $hours hours."; my $msg = new Mail::Send; -- 2.30.2