From f0c078cb87970f248e3d86cbc8b219d89690119d Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Mon, 3 Mar 2008 19:59:05 -0700
Subject: [PATCH] Added ability to deal with negative data values.

---
 zfs-log-parser | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/zfs-log-parser b/zfs-log-parser
index 26b0589..5c28003 100755
--- a/zfs-log-parser
+++ b/zfs-log-parser
@@ -37,9 +37,9 @@ sub adjust_duration {
 
 sub adjust_data {
     my ($data) = @_;
-    if($data > ($giga)) { $data = $data / $giga; $data = sprintf("%2.2fGb",$data); }
-    elsif($data > ($mega)) { $data = int($data / $mega); $data = "$data"."Mb"; }
-    elsif($data > ($kilo)) { $data = int($data / $kilo); $data = "$data"."Kb"; }
+    if(abs($data) > ($giga)) { $data = $data / $giga; $data = sprintf("%2.2fGb",$data); }
+    elsif(abs($data) > ($mega)) { $data = int($data / $mega); $data = "$data"."Mb"; }
+    elsif(abs($data) > ($kilo)) { $data = int($data / $kilo); $data = "$data"."Kb"; }
     return $data;
 }
 
-- 
2.34.1