ColinPitrat / kalenji-gps-watch-reader

A tool to import data from some Kalenji running watches
GNU General Public License v3.0
30 stars 11 forks source link

Incorrect time in GPX export (local time exported as UTC) #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Plug the watch
2. Export activities to GPX

What is the expected output? What do you see instead?
The time used in GPX file is in UTC "timezone" whereas time configured in watch 
is UTC+2
For example, my watch time is set to 11:00 in UTC+2 (france), GPX file will 
have 2014-06-01T11:00:00.4Z which correspon to 11:00 in UTC

What version of the product are you using? On what operating system?
Geonaute OnMove 500
Ubuntu 14.04 64bits

Please provide any additional information below.

Original issue reported on code.google.com by perrinma...@gmail.com on 3 Jun 2014 at 3:31

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,

you're absolutely right ! From gpx.xsd:

''Creation/modification timestamp for element. Date and time in are in Univeral 
Coordinated Time (UTC), not local time! Conforms to ISO 8601 specification for 
date/time representation. Fractional seconds are allowed for millisecond timing 
in tracklogs.''

But the watch returns local time. I have to find out if the time offset is 
available somewhere. Unfortunately, as it's a small information, it will 
probably be very hard to find this out.

Would it be possible for you to run a few tests with your watch with log 
activated (this is the case by default, logs are in subdirectory logs of your 
import directory) ? 

The idea would be to do, with few different timezone (at least 3 values for x): 
Set timezone to UTC+x, do a small sessions (5 seconds, not even necessary to go 
out and have the GPS working) and import it.

My job then will be to find if the information of the timezone offset is given 
by the watch ...

Regards,
Colin

Note to myself: check this for other devices

Original comment by colin.pi...@gmail.com on 3 Jun 2014 at 4:11

GoogleCodeExporter commented 9 years ago
Here is a log file with export of three activities. One with time set to 22:50, 
one with time set to 00:50 and one with time set to 02:50

Hope it will help.

Original comment by perrinma...@gmail.com on 3 Jun 2014 at 9:02

Attachments:

GoogleCodeExporter commented 9 years ago
Another thing, in configuration of my watch, we don't set timezone but only 
time.
So, I am not sure that timezone is exported.

Original comment by perrinma...@gmail.com on 4 Jun 2014 at 7:19

GoogleCodeExporter commented 9 years ago
I think you're right.
So it means I should assume the watch and the computer are synchronized and 
convert the values from localtime to UTC.

This needs to be done in two places:
 - Session where time is stored as both time_t and tm. The tm must be modified to be converted to UTC (using gmtime)
 - Point where time is stored as time_t but for display, conversion is done using localtime instead of gmtime.

Original comment by colin.pi...@gmail.com on 4 Jun 2014 at 11:48

GoogleCodeExporter commented 9 years ago
Patch prepared but breaking all test cases !
This is easy to fix for my specific case, but this breaks the test cases in 
general: this will depend on the localtime settings of the tester.

Needs to be determined how to fix this - modify locales in test cases ?

Original comment by colin.pi...@gmail.com on 30 Jun 2014 at 3:36

GoogleCodeExporter commented 9 years ago
Fix commited and test cases updated.
Can you please check that SVN version is solving your issue ?

Regards,
Colin

Original comment by colin.pi...@gmail.com on 2 Jul 2014 at 11:40

GoogleCodeExporter commented 9 years ago
I will try the new version tonight.

Thanks,
Mathieu.

Original comment by perrinma...@gmail.com on 2 Jul 2014 at 12:22

GoogleCodeExporter commented 9 years ago
I just tried a new export with real run and it works ! It is now the right time 
when I import it in Strava.

Thanks you very much for the hard work Colin !

Mathieu.

Original comment by perrinma...@gmail.com on 2 Jul 2014 at 6:56

GoogleCodeExporter commented 9 years ago

Original comment by colin.pi...@gmail.com on 2 Jul 2014 at 9:09