{
const int enough = 3000;
struct sample *result;
- int timelimit, depthlimit;
+ int depthlimit;
if (sample >= end)
return 0;
- timelimit = 24*60*60;
depthlimit = sample->depth.mm;
result = NULL;
return NULL;
time = sample->time.seconds;
depth = sample->depth.mm;
- if (time > timelimit)
- break;
if (minmax) {
if (depth <= depthlimit) {
result = sample;
depthlimit = depth;
- /* Look up to ten minutes into the future */
- timelimit = time + 600;
}
return result;
}
{
struct sample *max, *min;
- if (b < a)
+ if (b <= a)
return;
- if (b->time.seconds - a->time.seconds < 3*60)
+ if (b[-1].time.seconds - a->time.seconds < 3*60)
return;
max = next_minmax(a, b, 1);
cairo_set_font_size(gc->cr, 14);
- /*
- * We never take the last sample into account.
- * It should be a surface event anyway, although
- * there are buggy cases where it isn't..
- */
sample = dive->sample;
- end = dive->sample + dive->samples - 1;
+ end = dive->sample + dive->samples;
plot_text_samples(gc, sample, end);
}