Sensor API broken in latest Gear S2 firmware: wrong clock used

Sensor API broken in latest Gear S2 firmware: wrong clock used

BY 13 Aug 2016 Native Application Development

Already submitted a bug for this [PTAPI-59], but not sure that anyone is actually monitoring those.

 

The sensor framework in Wearable 2.3.1 (prior to Gear S2 firmware R732XXU2DPFB) obtained all sensor event timestamps from CLOCK_MONOTONIC in microseconds. The sensor guide says: “The timestamp is the monotonic time since some unspecified starting point, usually the last boot time, in micro seconds.”

 

I just ran our app on the most recent firmware version and all timestamps are now coming from CLOCK_REALTIME. All timestamp calculations, such as figuring out how long ago an event happened are now broken. Furthermore, you can’t even calculate the relative time between events now (reliably) because CLOCK_REALTIME can jump at any point.

 

How the hell does a change like this make it into a firmware update?!? CLOCK_MONOTONIC was exactly the right clock to use for this purpose (CLOCK_BOOTTIME would have been better), but even if you disagree, this is major backward compatibility break that needs to be fixed quickly.

Written by