Fix bad profiles when profile ringbuffer wraps around
Fix bad profiles when profile ringbuffer wraps around

The method used to calculate the data used by dives (to determine when
we run out of ringbuffer) incorrectly didn't include surface sample
data. Ten to twenty minute of sample data is recorded at the surface in
case the diver re-descends, continuing the dive. The code then thought
that older dive profiles were not yet overwritten. The improper data was
returned to the user.

henrik242/libdivecomputer,henrik242/libdivecomputer