summaryrefslogtreecommitdiffstats
path: root/parse-xml.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2013-05-15 08:07:41 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-15 01:22:11 -0400
commit97594ffd23f9bfb7e5e14d15fa79a0e5f3075438 (patch)
tree6dcf10075fab3cb46eaf09d916cfacd99222f025 /parse-xml.c
parent935273c9e7b60e7f007cf0ea6dd1f3da661e10cf (diff)
downloadsubsurface-97594ffd23f9bfb7e5e14d15fa79a0e5f3075438.tar.gz
Fix DM4 dive time
DM4 stores the divetime in local time. The conversion from seconds since year 1 was 2 hours off. (So there is no timezones involved, which is good for us!) Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r--parse-xml.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/parse-xml.c b/parse-xml.c
index d6c189cd2..698b31171 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -1690,8 +1690,6 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
float *profileBlob;
unsigned char *tempBlob;
int *pressureBlob;
- time_t when;
- struct tm *tm;
char *err = NULL;
char get_events_template[] = "select * from Mark where DiveId = %d";
char get_events[64];
@@ -1699,15 +1697,7 @@ extern int dm4_dive(void *param, int columns, char **data, char **column)
dive_start();
cur_dive->number = atoi(data[0]);
- when = (time_t)(atol(data[1]));
- tm = localtime(&when);
-
- /* Bailing out if localtime returns NULL */
- if (!tm)
- return -1;
-
- /* Timezones are not taken into account */
- cur_dive->when = mktime(tm);
+ cur_dive->when = (time_t)(atol(data[1]));
if (data[2])
utf8_string(data[2], &cur_dive->notes);
@@ -1821,7 +1811,7 @@ int parse_dm4_buffer(const char *url, const char *buffer, int size,
/* StartTime is converted from Suunto's nano seconds to standard
* time. We also need epoch, not seconds since year 1. */
- char get_dives[] = "select D.DiveId,StartTime/10000000-62135604000,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
+ char get_dives[] = "select D.DiveId,StartTime/10000000-62135596800,Note,Duration,SourceSerialNumber,Source,MaxDepth,SampleInterval,StartTemperature,BottomTemperature,D.StartPressure,D.EndPressure,Size,CylinderWorkPressure,SurfacePressure,DiveTime,SampleInterval,ProfileBlob,TemperatureBlob,PressureBlob,Oxygen,Helium,MIX.StartPressure,MIX.EndPressure FROM Dive AS D JOIN DiveMixture AS MIX ON D.DiveId=MIX.DiveId";
retval = sqlite3_open(url,&handle);