in reply to Bad calculations?

First of all, your code is very repetitive--you're doing the same thing three times. You might find it better to put most of the code into a subroutine that could get called three times with different values for your different interfaces. There's also a lot of potential cleanup that could be done. But I think your real problem is that when the counter resets, you're setting the previous value (say, $peth0in) too late, after the division. So you're setting it to the number of bytes per second, not the total number so far.

Replies are listed 'Best First'.
Re^2: Bad calculations?
by crep (Novice) on Jul 26, 2004 at 17:37 UTC
    Yes, I'm sorry about the bad coding. But I'm not sure what you're saying about setting the previous values too early... Before I do any calculation with $eth0in, say, I set $tmp to that value, and set $peth0in to $tmp at the end. So in essance, we still get the original (bytes, not b/s) value.

    Well, at least that's how I designed it to work, maybe it's not?

    Thanks,Jack C
    jack@crepinc.com