I am slowly porting over some of my Pebble apps for the Core devices. One app (Big Stopwatch) I see strange behavior when computing the elapsed time.
Take a look at this code from a 1/10th second timer function in C:
time_t time_now;
uint16_t ms_now;
time_ms(&time_now, &ms_now);
APP_LOG(APP_LOG_LEVEL_ERROR, "time_now=%lld ms_now=%d", (long long int) time_now, ms_now);
Here are some console messages produced by the above code when using the gabbro Pebble simulator:
time_now=1779158976 ms_now=656
time_now=1779158977 ms_now=757
time_now=1779158977 ms_now=858
time_now=1779158977 ms_now=960
time_now=1779158977 ms_now=61
time_now=1779158977 ms_now=161
time_now=1779158977 ms_now=262
time_now=1779158977 ms_now=362
time_now=1779158977 ms_now=462
Is there any explanation for why the MILLISECONDS do not line up with the SECONDS value? See how the millisecond value drops from 960 to 61, but the seconds value remains the same.
This behavior does not make sense to me, and when I compute elapsed time (by combining the seconds and milliseconds) the numbers are not always increasing.
Caveat: I cannot test this on gabbro hardware since I don’t have one (yet!). By comparison the basalt simulator appears to be correct but the emery does not.