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

Saved file - date issue

I can successfully write files and read them, but I am running into some issues.

 

When I read the stats, the date is completely off. I am about 30 days in the future. I think it also creates issue with app not reading the  new files generated by the companion, as it does not see it as new.

  • [11:14:05 AM]File size: 1067 bytes
  • [11:14:05 AM]Last modified: Tue Jan 02 2018 13:49:08 GMT-06:00

I am using the basic stats code as from the documentation:

let stats = fs.statSync("tides.txt");
if (stats) {
  console.log("File size: " + stats.size + " bytes");
  console.log("Last modified: " + stats.mtime);
}

- Also, is there a way to write a file for the clock face, and have different apps access it? That way it does not need to be created for each app all the time.

Best Answer
6 REPLIES 6

That's strange. We'll look into this one for you. Thanks!

Best Answer
0 Votes

@JonFitbit while you are looking into it, I noticed another weird behavior/bug.

I have the same code for one App and one Watch Face. The App updates the file and reads it, updating info. The watch face only does it when connected through the studio. Otherwise it won't read/fetch new data.

 

EDIT - Same exact code. Copied and pasted. App fetch new data and write a file, refreshing it as time goes by.. Watch face doesn't.

 

Best Answer
0 Votes

Hi Jon,

This behaviour still exists:

rhrData.cbor info: 
File size: 249 bytes
Last modified: Sat Jan 27 2018 13:35:30 GMT+11:00
 
stats.mtime
is returning a month, minus half a day in the future
 
stats.mtime: Sat Jan 27 2018 13:35:30 GMT+11:00
now: Thu Dec 28 2017 00:38:02 GMT+11:00
Best Answer
0 Votes

stats.mtime is showing about 38 hours ahead for me.

example:

unix timestamp when file was created 1617564380

stats.mtime shows: 1617696648

the difference is  132268 seconds

just to confirm, the mtime was a future date of around 38 hours ahead which had not yet been reached, so it can in no way be caused by the file being unknowingly modified 

 

using SDK 4.2.2

 

Best Answer
0 Votes

Has there been any progress on this bug?

Best Answer
0 Votes

The original ticket had been closed since they'd been unable to reproduce it.

 

Can you check something for me. Reboot your watch and try creating a new file. 

 

Does the problem still exist?

 

Thanks

Best Answer
0 Votes