Core: move is-single-day-trip and count-shown functions into core

These functionality was used by the desktop filter. To unify desktop
and mobile, move it into two new functions in divelist.c

Since one of them is the only caller of is_same_day() move that
likewise into divelist.c and make it of static linkage.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-11-22 23:11:23 +01:00 committed by Dirk Hohndel
parent 68414531ad
commit 70897dd1b7
5 changed files with 40 additions and 25 deletions

View file

@ -950,22 +950,6 @@ extern "C" char *get_current_date()
return copy_qstring(current_date);
}
bool is_same_day(timestamp_t trip_when, timestamp_t dive_when)
{
static timestamp_t twhen = (timestamp_t) 0;
static struct tm tmt;
struct tm tmd;
utc_mkdate(dive_when, &tmd);
if (twhen != trip_when) {
twhen = trip_when;
utc_mkdate(twhen, &tmt);
}
return (tmd.tm_mday == tmt.tm_mday) && (tmd.tm_mon == tmt.tm_mon) && (tmd.tm_year == tmt.tm_year);
}
QString get_trip_date_string(timestamp_t when, int nr, bool getday)
{
struct tm tm;