Rounds the percentage better now.
authorheiko
Tue, 16 Jan 2007 12:25:15 +0000
changeset 42 9c16227f96aa
parent 41 ed68e784c318
child 43 c6b65799fdb3
Rounds the percentage better now.
exigrey.pl
--- a/exigrey.pl	Mon Jan 15 23:01:44 2007 +0000
+++ b/exigrey.pl	Tue Jan 16 12:25:15 2007 +0000
@@ -98,9 +98,9 @@
 	    $_ = <<__;
 	    date: %s
 	      db: $db (ls: %.1f MB / du: %.1f MB)
-	   total: $seen
-        returned: %*d (%2d%%)
-    not returned: %*d (%2d%%)
+	   total: $seen (100%%)
+        returned: %*d (%3d%%)
+    not returned: %*d (%3d%%)
 oldest (created): %.1f days (%s)
    oldest (used): %.1f days (%s)
 __
@@ -108,8 +108,8 @@
 		    scalar(localtime), 
 		    (-s $db) / (1024*1024),
 		    ((stat $db)[12]*512)/(1024*1024),
-		    length($seen), $returned, int(100 * ($returned/$seen)),
-		    length($seen), $seen - $returned, int(100 * ($seen-$returned)/$seen), 
+		    length($seen), $returned, int(0.5 + 100 * ($returned/$seen)),
+		    length($seen), $seen - $returned, int(0.5 + 100 * ($seen-$returned)/$seen), 
 		    ((time - $oldest_c) / 86400), scalar(localtime $oldest_c),
 		    ((time - $oldest_u) / 86400), scalar(localtime $oldest_u);
 	    print "\n" if @ARGV;