summaryrefslogtreecommitdiffstats
path: root/uemis.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2012-12-05 09:59:52 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-05 10:34:02 -0800
commit5e5e3460acf9d29b03aff71228aff01e31a3bf45 (patch)
tree07629133d0d9ea1948692690929582ae9029e12e /uemis.c
parent708df33539ef3b6d3cfde435df93fd4475cdde75 (diff)
downloadsubsurface-5e5e3460acf9d29b03aff71228aff01e31a3bf45.tar.gz
Turn latitude and longitude into integer micro-degree values
This actually makes us internally use 'micro-degrees' for latitude and longitude, and we never turn them into floating point either at parse time or save time. That said, the Uemis downloader internally does still use atof() when converting things, which is likely a bug (locale issues and all that), but I'll ask Dirk to check it out. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis.c')
-rw-r--r--uemis.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/uemis.c b/uemis.c
index af344a5f1..4306a1b55 100644
--- a/uemis.c
+++ b/uemis.c
@@ -15,6 +15,7 @@
#include <glib/gi18n.h>
#define __USE_XOPEN
#include <time.h>
+#include <math.h>
#include "dive.h"
#include "uemis.h"
@@ -107,8 +108,8 @@ struct uemis_helper {
int lbs;
int divespot;
char **location;
- double *latitude;
- double *longitude;
+ degrees_t *latitude;
+ degrees_t *longitude;
struct uemis_helper *next;
};
static struct uemis_helper *uemis_helper = NULL;
@@ -153,7 +154,7 @@ int uemis_get_weight_unit(int diveid)
return 0;
}
-void uemis_mark_divelocation(int diveid, int divespot, char **location, double *longitude, double *latitude)
+void uemis_mark_divelocation(int diveid, int divespot, char **location, degrees_t *longitude, degrees_t *latitude)
{
struct uemis_helper *hp = uemis_get_helper(diveid);
hp->divespot = divespot;
@@ -168,8 +169,8 @@ void uemis_set_divelocation(int divespot, char *text, double longitude, double l
while (hp) {
if (hp->divespot == divespot && hp->location) {
*hp->location = text;
- *hp->longitude = longitude;
- *hp->latitude = latitude;
+ hp->longitude->udeg = round(longitude * 1000000);
+ hp->latitude->udeg = round(latitude * 1000000);
}
hp = hp->next;
}