From fcccc7b6d2f089f194411bf33b19f8669c6e832e Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Thu, 18 Oct 2007 21:52:58 +0000 Subject: [PATCH] Ticket #1494 - when wrapping at 32bits, the difference is 32bits - last + current, not some massive negative number --- usr/local/www/graph.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php index f0230e63ae..640df346bd 100755 --- a/usr/local/www/graph.php +++ b/usr/local/www/graph.php @@ -196,8 +196,18 @@ function plot_data(obj) { return handle_error(); var diff_ugmt = ugmt - last_ugmt; - var diff_ifin = ifin - last_ifin; - var diff_ifout = ifout - last_ifout; + if (last_ifin < ifin) { + var diff_ifin = ifin - last_ifin; + } else { + real_last_ifin = (4294967296 - last_ifin) + var diff_ifin = ifin + real_last_ifin; + } + if (last_ifout < ifout) { + var diff_ifout = ifout - last_ifout; + } else { + real_last_ifout = (4294967296 - last_ifout) + var diff_ifout = ifout + real_last_ifout; + } if (diff_ugmt == 0) diff_ugmt = 1; /* avoid division by zero */