summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-01 14:07:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-01 09:42:31 -0700
commit9c70261c0e294d46d62d99725a1ae9ddc01eb1cf (patch)
treea1ae27fd5a27700f8b272b0faad8a5d2bc2910b0 /core
parent50b195142b07e58a1c0e3bfe5c725bf5e3dd4020 (diff)
downloadsubsurface-9c70261c0e294d46d62d99725a1ae9ddc01eb1cf.tar.gz
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>
Diffstat (limited to 'core')
-rw-r--r--core/cochran.c1
-rw-r--r--core/dive.h3
-rw-r--r--core/exif.cpp2
-rw-r--r--core/import-csv.c1
-rw-r--r--core/libdivecomputer.c2
-rw-r--r--core/load-git.c2
-rw-r--r--core/parse-gpx.cpp2
-rw-r--r--core/parse-xml.c2
-rw-r--r--core/planner.c1
-rw-r--r--core/qthelper.cpp3
-rw-r--r--core/save-git.c2
-rw-r--r--core/save-html.c1
-rw-r--r--core/save-xml.c2
-rw-r--r--core/statistics.c1
-rw-r--r--core/subsurface-time.h19
-rw-r--r--core/time.c2
-rw-r--r--core/trip.c1
-rw-r--r--core/uemis-downloader.c1
-rw-r--r--core/xmp_parser.cpp3
19 files changed, 36 insertions, 15 deletions
diff --git a/core/cochran.c b/core/cochran.c
index 55460014a..7292d425a 100644
--- a/core/cochran.c
+++ b/core/cochran.c
@@ -15,6 +15,7 @@
#include "dive.h"
#include "file.h"
+#include "subsurface-time.h"
#include "units.h"
#include "sha1.h"
#include "gettext.h"
diff --git a/core/dive.h b/core/dive.h
index c908750d3..ca35ff46a 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -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);
diff --git a/core/exif.cpp b/core/exif.cpp
index 17983a0ff..4f6cb89e1 100644
--- a/core/exif.cpp
+++ b/core/exif.cpp
@@ -35,7 +35,7 @@
#include <cstdint>
#include <stdio.h>
#include <vector>
-#include "dive.h"
+#include "subsurface-time.h"
using std::string;
diff --git a/core/import-csv.c b/core/import-csv.c
index 75b4cd63d..8d6f0bcf0 100644
--- a/core/import-csv.c
+++ b/core/import-csv.c
@@ -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"
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 88e67e317..f2bc9df41 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -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>
diff --git a/core/load-git.c b/core/load-git.c
index 6af1f004f..ec922d37b 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -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;
diff --git a/core/parse-gpx.cpp b/core/parse-gpx.cpp
index 9649780c7..11e332091 100644
--- a/core/parse-gpx.cpp
+++ b/core/parse-gpx.cpp
@@ -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>
diff --git a/core/parse-xml.c b/core/parse-xml.c
index 50639d1d1..164b17b83 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -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"
diff --git a/core/planner.c b/core/planner.c
index 5119938f0..aaabeddf7 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -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"
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 6ac539ac1..082e16194 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -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"
diff --git a/core/save-git.c b/core/save-git.c
index d6c1814b4..01f804006 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -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)
diff --git a/core/save-html.c b/core/save-html.c
index 894dc70c0..5a01a6d2e 100644
--- a/core/save-html.c
+++ b/core/save-html.c
@@ -13,6 +13,7 @@
#include "file.h"
#include "picture.h"
#include "tag.h"
+#include "subsurface-time.h"
#include "trip.h"
#include <stdio.h>
diff --git a/core/save-xml.c b/core/save-xml.c
index 71b2da4b4..8e3d212eb 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -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"
diff --git a/core/statistics.c b/core/statistics.c
index d37e4794f..eeb45e1ae 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -12,6 +12,7 @@
#include "dive.h"
#include "display.h"
+#include "subsurface-time.h"
#include "trip.h"
#include "statistics.h"
#include "units.h"
diff --git a/core/subsurface-time.h b/core/subsurface-time.h
new file mode 100644
index 000000000..38d6c10de
--- /dev/null
+++ b/core/subsurface-time.h
@@ -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
diff --git a/core/time.c b/core/time.c
index 7b8a6ff0f..d339ffa30 100644
--- a/core/time.c
+++ b/core/time.c
@@ -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
diff --git a/core/trip.c b/core/trip.c
index c35cb0e43..570bd1fee 100644
--- a/core/trip.c
+++ b/core/trip.c
@@ -2,6 +2,7 @@
#include "trip.h"
#include "dive.h"
+#include "subsurface-time.h"
#include "subsurface-string.h"
#include "selection.h"
#include "table.h"
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index 2d208087e..91c1e99e6 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -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\'")
diff --git a/core/xmp_parser.cpp b/core/xmp_parser.cpp
index 4ce6cef31..8d052b66f 100644
--- a/core/xmp_parser.cpp
+++ b/core/xmp_parser.cpp
@@ -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]]"