# [rrd-users] Re: Why Double Counter Wrap ?

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Oct 26 18:13:28 MEST 2004

```On Tue, Oct 26, 2004 at 03:43:04PM +0200, Christian Mönneckes wrote:

> update values with 1 second delay:
>
>     # UPDATE TIME: Tue Oct 26 14:45:01 2004
>     rrdtool update test1.rrd --template count 1098794701:5000

interval from 1098794400 to 1098794700 is updated, and the rate
is remembered because it is also valid between 1098794700 and 1098794701

This rate is unknown (here) but it is also not important for this explanation.

>
>     # UPDATE TIME: Tue Oct 26 14:50:01 2004
>     rrdtool update test.rrd --template count 1098795001:6000

interval from 1098794700 to 1098795000 is updated, using the rate
previously remembered, and the current rate.  Also, the rate is
remembered because it is valid between 1098795000 and 1098795001

(6000-5000) per 300 seconds -> rate = 10/3

>     # UPDATE TIME: Tue Oct 26 14:55:01 2004
>     rrdtool update test.rrd --template count 1098795301:100

interval from 1098795000 to 1098795300 is updated, using the rate
previously remembered, and the current rate.  Also, the rate is
remembered because it is valid between 1098795300 and 1098795301

2^32 + 100 - 6000 per 300 seconds -> rate 14316537.something

>     # UPDATE TIME: Tue Oct 26 15:00:01 2004
>     rrdtool update test.rrd --template count 1098795601:100

interval from 1098795300 to 1098795600 is updated, using the rate
previously remembered, and the current rate.  Also, the rate is
remembered because it is valid between 1098795600 and 1098795601

(100-100) per 300 seconds -> rate = 0

time 1098795300 to 1098795301  rate 14316537
time 1098795301 to 1098795600  rate 0
time 1098795300 to 1098795600  rate (1/300)*14316537 + (299/300)*0 = 47721

>     1098795000: 3.3333333333e+00
>     1098795300: 1.4268816204e+07 # <-- first counter wrap
>     1098795600: 4.7721793289e+04 # <-- second counter wrap, Why ???
>     1098795900: 0.0000000000e+00

rounding errors in my explanation; 47721 equals 4.7721e+04

Alex
--