1

Time conversion when importing .GPX files (Read 59 times)

kcam


    Eric,

    I am currently experiencing a 'bug' (at least I think it is) with importation of .gpx files.  GPX files report the time in UTC format and I believe RA is interpreting that as 24 hr military time.  For example, the time reported in my .gpx file for today's run was 19:31:47 (UTC format) which is then converted to 7:31:47 PM by RA (not correct).  I'm in PST which is 8 time zones from GMT so the correct local time is 11:31:47 AM

     

    Currently I am just manually correcting this in my logs but it would be nice if it could be done automatically.  Are other users that import gpx files seeing this problem?

    Thanks

    eric :)


      HI Ken,

      Could you send me the GPX file so I can take a look?  I'm fairly certain that the GPX importer is behaving properly.  Chances are that the GPX file wasn't encoded properly.  I'll have to take a look to be sure.  Where did you obtain this file from?

       

      eric Smile

      kcam


        No problem to send you the .GPX file.  I'm using my Android phone with Trimble Outdoors Navigator to generate the gpx files ... until I can locate my misplaced Garmin GPS! Sad

         

        Hmm, how do I send you the file?  Could you just look at my latest imported run?

        eric :)


          No problem to send you the .GPX file.  I'm using my Android phone with Trimble Outdoors Navigator to generate the gpx files ... until I can locate my misplaced Garmin GPS! Sad

           

          Hmm, how do I send you the file?  Could you just look at my latest imported run?

           

          I have to look at the original GPX file to compare the times in the file against what is displayed after the export.  If you used an app, then in all likely, it did not properly encode the time but I need to confirm.  Please send the file to support@runningahead.com.  Thanks!

           

          eric Smile

          npaden


            The same thing happens to runkeeper gpx imports.  I'm in central time and they are always off 5 hours.

            Age: 50 Weight: 224 Height: 6'3" (Goal weight 195)

            Current PR's:  Mara 3:14:36* (2017); HM 1:36:13 (2017); 10K 43:59 (2014); 5K 21:12 (2016)

            kcam


              File sent.

               

              BTW, before I posed this question here I asked the same question on the Trimble Navigator forums (I assumed there was something wrong with the Trimble-generated gpx file) and this is the response I got:

               

              "According to GPX standards, dates and times in those files are going to be in UTC, not the local time for the trip location (see http://en.wikipedia.org/wiki/GPS_eXchange_Format). So if you're trying to measure times in a GPX by your local time, you'll need to shift them according to your time zone offset from GMT."

               

              MTA:  one other minor item is that, even though I have my global preference set to make all of my maps PUBLIC, the maps from imported .gpx files are private.

              eric :)


                Thanks for sending me the file.  Despite what Trimble Navigator said, they are encoding their data in local time.  In the file you sent me, the first data point's time is "2014-01-20T19:31:47".  UTC time should be "2014-01-20T19:31:47Z".  Having the time in UTC is not sufficient because it does not include timezone information.

                 

                Without a timezone indicator, the time is technically in local time but in reality the timezone is undefined.  Let's say you recorded the route in Boston (UTC -5), but did not upload the file to RA until you flew back home in San Francisco (UTC -8).  We'll pretend RA's servers are located in Arizona (UTC -4) to make it interesting.  When the importer sees "2014-01-20T19:31:47", what is the correct time?  It's local time, but local to what?  Therefore, the 'Z' suffix is needed to indicate UTC.

                 

                Using the same Wikipedia reference that they kindly provided, please note that all times have the Z suffix in the sample GPX file.

                 

                eric Smile

                kcam


                  OK.  Will see if I can get them to get on the issue as quickly as you did ... but somehow I doubt it!

                   

                  If Trimble modifies their GPX code to include the Zulu designator the time will be imported correctly?

                   

                  Thanks for your support.

                  eric :)


                    OK.  Will see if I can get them to get on the issue as quickly as you did ... but somehow I doubt it!

                     

                    If Trimble modifies their GPX code to include the Zulu designator the time will be imported correctly?

                     

                    Thanks for your support.

                     

                    If Zulu is added, then the times will be correctly imported.

                     

                    BTW, using Z to designate UTC is *required* as per http://www.w3.org/TR/xmlschema-2/,   RA can accept times from other timezones.  For example, "2014-01-20T19:31:47-08:00" will be correctly translated to Jan 20, 2014, 11:31 PST.  While it is true that the GPX specification says that all times are in UTC, it is also an XML file, and thus adhere to the XML datetime specification.  That means all times must have a timezone indicator, or Zulu for UTC.

                    kcam


                      Guess what?  Trimble agrees with you (as they must as it the Z designator is technically correct and required)!  Though they didn't outright commit to fix it I suspect they will.  Impressed with support from both RA and Trimble.

                       

                      Thanks

                      LedLincoln


                      not bad for mile 25

                        I'm curious.  I don't see in the RA options where my timezone is specified.  The closest thing I see is the default map location.  Is that used for determining our local timezone?  If RA indeed knows our timezone, what if we run outside our normal timezone, then provide a .GPX that lacks the timezone info?

                        eric :)


                          RA obtains your timezone based on your computer's time.  If you ran the Boston Marathon, which starts at 10 AM EDT, and then fly back home to San Francisco before uploading your data, the start time will be relative to PDT, and will appear as 7 AM PDT.  I suppose the correct solution is to determine the timezone based on the location of your run.  This is no trivial task, mostly because I need boundary information to calculate timezones.