Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Going ahead in time or Time Discrepency?

Hello All,

Curious to know if any of you had this problem.

I read the fitbit syncs its time to the GPS but somehow I am getting a time stamp 30 seconds ahead in time on the first reading and subsequential readings are off by varying time.

 

For Example the following code when called at 8:08:54 at startup will give me a timestamp for 8:09:26.

userbuffer[17] = Date.now();
console.log(userbuffer[17]);

 

 This is problematic for 2 reasons. One its wrong and two its how I lock the referencing of the ACC and GYRO timestamps. The ACC and GYRO timestamps seem to pick random arbitrary reference points in time. I was calling the system time when I start the ACC and GYRO so I would have some reference point as to when they really are but that doesn't seem to be working.

 

This leads me to my second concern. The first call in time results in a 30 second difference.

However, the second call of time when the first GPS fix occurs it is off by 1.5 seconds to the computer time.

 

function getPosition()
{
  watchID = geolocation.watchPosition(locationSuccess, locationError);
  
}


function locationSuccess(position) {
  console.log(Date.now());
  let timeValueBuffer = position.timestamp;
  GPSBuffer[incrementer] = timeValueBuffer;
  GPSBuffer[incrementer+100] = position.coords.latitude;
  GPSBuffer[incrementer+200 ] = position.coords.longitude;
  GPSBuffer[incrementer+300 ] = position.coords.accuracy;
  console.log("TimeStamp: " + position.timestamp, "Latitude: " + position.coords.latitude,
                "Longitude: " + position.coords.longitude, "Accuracy: " + position.coords.accuracy,);
  elements.style.fill = "#00a629";
  console.log(userbuffer[17]);
  console.log(GPSBuffer[incrementer]);
  console.log(position.timestamp);

 

This line 'console.log(Date.now());'

At a time of [08:09:05] it returns the time 1564121343529 which is 8:09:03 and 529 ms.

Maybe it is a rounding error or delay in the computer,

But the GPS Time returns a time of 1564121343000. This is 8:09:03. This time is 23 seconds before the initial instance of calling Date.now() and 0.529 seconds before the second instance of calling Date.now() (which is called after the GPS fix). This 0.529 seconds varies to even 0.7 seconds. This doesn't seem to make sense. The second I get a GPS fix I call the time. Is there really that much a delay and does the delay drift?

 

Why is my initial request for time so far in advance? (Second Test gets a first initial time 1 minute in advance)

Also due to the nature of the timestamps in the ACC and GYRO not using the system time, how do you guys 'lock' it to a reference point such as the system clock to know when the data occurs? I am trying to max the GPS fixes to points in the ACCEL and GYRO data but its not working due to these timing errors.

 

Fun Challenge I can't solve:

 

console.log(userbuffer[17]);

console.log(GPSBuffer[incrementer]);

 

those two lines of code return the exact same value every time which is from the first time I assign userbuffer[17]. Yet you can see in the code GPSBuffer[incrementer] is constantly being changed by a new timestamp. Also not seen is incrementer incrementing so it is also in a different place in the buffer as well.  I can't for the life of me figure out why it is returning the same value.

 

 

Best Answer
0 Votes
4 REPLIES 4

I'd probably need to see a bit more of the code. Is the project on GitHub? Also, which Fitbit device are you using?

Best Answer
0 Votes

Ionic

 

On github: https://github.com/philipvms/FitbitCode

 

Also transferring of Data takes an hour for just 2mb of data. Is their some settings to make it use a faster connection rate?

 

 

 

Best Answer
0 Votes

That transfer rate is about the same as I get. 😞

Peter McLennan
Gondwana Software
Best Answer
0 Votes

@JonFitbithave you had a chance to look at it?

Best Answer
0 Votes