cleanup: move declaration of utc_mk* functions to new subsurface-time.h header

No point in slurping in all of dive.h for translation units that only
want to do some time manipulation without ever touching a dive.

Don't call the header "time.h", because we don't want to end up in a
confusion with the system header of the same name.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-05-01 14:07:59 +02:00 committed by Dirk Hohndel
parent 50b195142b
commit 9c70261c0e
21 changed files with 38 additions and 16 deletions

View file

@ -7,6 +7,7 @@
#include "core/divesite.h"
#include "core/gettextfromc.h"
#include "core/tag.h"
#include "core/subsurface-time.h"
#include "core/file.h"
#include "core/errorhelper.h"
#include "core/divefilter.h"

View file

@ -15,6 +15,7 @@
#include "dive.h"
#include "file.h"
#include "subsurface-time.h"
#include "units.h"
#include "sha1.h"
#include "gettext.h"

View file

@ -309,9 +309,6 @@ extern bool subsurface_user_is_root(void);
extern timestamp_t get_times();
extern timestamp_t utc_mktime(struct tm *tm);
extern void utc_mkdate(timestamp_t, struct tm *tm);
extern struct dive *alloc_dive(void);
extern void free_dive(struct dive *);
extern void free_dive_dcs(struct divecomputer *dc);

View file

@ -35,7 +35,7 @@
#include <cstdint>
#include <stdio.h>
#include <vector>
#include "dive.h"
#include "subsurface-time.h"
using std::string;

View file

@ -8,6 +8,7 @@
#include "divelist.h"
#include "file.h"
#include "parse.h"
#include "subsurface-time.h"
#include "divelist.h"
#include "gettext.h"
#include "import-csv.h"

View file

@ -12,7 +12,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include "gettext.h"
#include "divesite.h"
#include "subsurface-string.h"
@ -21,6 +20,7 @@
#include "display.h"
#include "errorhelper.h"
#include "sha1.h"
#include "subsurface-time.h"
#include "timer.h"
#include <libdivecomputer/version.h>

View file

@ -5,7 +5,6 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -26,6 +25,7 @@
#include "picture.h"
#include "qthelper.h"
#include "tag.h"
#include "subsurface-time.h"
const char *saved_git_id = NULL;

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "core/parse-gpx.h"
#include "core/dive.h"
#include "core/subsurface-time.h"
#include <QFile>
#include <QXmlStreamReader>

View file

@ -13,7 +13,6 @@
#include <unistd.h>
#include <assert.h>
#define __USE_XOPEN
#include <time.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/tree.h>
@ -26,6 +25,7 @@
#include "errorhelper.h"
#include "subsurface-string.h"
#include "parse.h"
#include "subsurface-time.h"
#include "trip.h"
#include "device.h"
#include "membuffer.h"

View file

@ -16,6 +16,7 @@
#include "deco.h"
#include "errorhelper.h"
#include "planner.h"
#include "subsurface-time.h"
#include "gettext.h"
#include "libdivecomputer/parser.h"
#include "qthelper.h"

View file

@ -12,11 +12,10 @@
#include "version.h"
#include "errorhelper.h"
#include "planner.h"
#include "time.h"
#include "subsurface-time.h"
#include "gettextfromc.h"
#include "applicationstate.h"
#include "metadata.h"
#include <sys/time.h>
#include "exif.h"
#include "file.h"
#include "picture.h"

View file

@ -10,7 +10,6 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
@ -30,6 +29,7 @@
#include "qthelper.h"
#include "gettext.h"
#include "tag.h"
#include "subsurface-time.h"
#define VA_BUF(b, fmt) do { va_list args; va_start(args, fmt); put_vformat(b, fmt, args); va_end(args); } while (0)

View file

@ -13,6 +13,7 @@
#include "file.h"
#include "picture.h"
#include "tag.h"
#include "subsurface-time.h"
#include "trip.h"
#include <stdio.h>

View file

@ -9,7 +9,6 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <fcntl.h>
@ -17,6 +16,7 @@
#include "divesite.h"
#include "errorhelper.h"
#include "subsurface-string.h"
#include "subsurface-time.h"
#include "trip.h"
#include "device.h"
#include "file.h"

View file

@ -12,6 +12,7 @@
#include "dive.h"
#include "display.h"
#include "subsurface-time.h"
#include "trip.h"
#include "statistics.h"
#include "units.h"

19
core/subsurface-time.h Normal file
View file

@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef TIME_H
#define TIME_H
#include "units.h"
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
extern timestamp_t utc_mktime(struct tm *tm);
extern void utc_mkdate(timestamp_t, struct tm *tm);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "subsurface-time.h"
#include <string.h>
#include "dive.h"
/*
* The date handling internally works in seconds since

View file

@ -2,6 +2,7 @@
#include "trip.h"
#include "dive.h"
#include "subsurface-time.h"
#include "subsurface-string.h"
#include "selection.h"
#include "table.h"

View file

@ -29,6 +29,7 @@
#include "errorhelper.h"
#include "file.h"
#include "tag.h"
#include "subsurface-time.h"
#include "core/subsurface-string.h"
#define ERR_FS_ALMOST_FULL QT_TRANSLATE_NOOP("gettextFromC", "Uemis Zurich: the file system is almost full.\nDisconnect/reconnect the dive computer\nand click \'Retry\'")

View file

@ -1,12 +1,11 @@
#include "xmp_parser.h"
#include "subsurface-string.h"
#include "subsurface-time.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <cctype>
extern "C" timestamp_t utc_mktime(struct tm *tm); // declared in core/dive.h
static timestamp_t parse_xmp_date(const char *date)
{
// Format: "yyyy-mm-dd[Thh:mm[:ss[.ms]][-05:00]]"

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/importgps.h"
#include "core/dive.h" // for utc_mkdate()
#include "core/subsurface-time.h"
/* Import dive coordinates from a GPS device and synchronise them with the dive profile information
of a dive computer. This file contains the infrastructure to: