core: move time_during_dive_with_offset() to struct dive

Feels natural in a C++ code base.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-30 22:02:20 +02:00 committed by bstoeger
parent 28814829e0
commit fb3a157462
3 changed files with 5 additions and 6 deletions

View file

@ -2274,10 +2274,10 @@ timestamp_t dive::endtime() const
return when + totaltime().seconds;
}
bool time_during_dive_with_offset(const struct dive *dive, timestamp_t when, timestamp_t offset)
bool dive::time_during_dive_with_offset(timestamp_t when, timestamp_t offset) const
{
timestamp_t start = dive->when;
timestamp_t end = dive->endtime();
timestamp_t start = when;
timestamp_t end = endtime();
return start - offset <= when && when <= end + offset;
}